eclipse-ditto / ditto

Eclipse Ditto™: Digital Twin framework of Eclipse IoT - main repository
https://eclipse.dev/ditto/
Eclipse Public License 2.0
695 stars 230 forks source link

Behavior of search/things API when 'indexedFieldsLimiting' feature is enabled #1899

Closed AkshayKumarCB closed 9 months ago

AkshayKumarCB commented 9 months ago

Hello, we have recently been evaluating Eclipse-Ditto 3.5. We have enabled the indexedFieldsLimiting feature for our solution. We can confirm that the search collection only contains the fields added to the configuration.

How is the search/things API expected to behave with the feature enabled? Without any fields parameter mentioned for the request for a given namespace (/api/2/search/things?namespace=x), what is the expected behavior? The current behavior I observe is that the entire Ditto thing is returned for the matching objects.

Question: For a search request without any fields listed, do we expect the entire Ditto thing to be returned or do we return only the indexed fields for a given matching Ditto thing?

thjaeckle commented 9 months ago

Hi.

Good to hear that the feature works for you. And yes, what you observe is exactly how Ditto behaves: The search index only contains the fields which you are able to search for - Ditto will however always return the complete Thing JSON, as this is not retrieved via the search index, but via the "things" service. And depending on what your user's permission is in the used policy of the thing, you will get all the persisted data your user is allowed to "READ".