Limit field length when querying Elasticsearch

Is there a way to limit the field to a certain number of characters when receiving results from Elasticsearch? I know how to limit my results to a specific set of fields, but I don’t see how to get only a part of the data. I would like to get only the first 100 characters to display data preview and I / O limits.

I saw that the highlighting makes it possible to set the size of the fragment, but I do not necessarily request anything from the field, I want a substring.

+5
source share
1 answer

Elasticsearch does not provide such an option. An ideal way to achieve this scenario is to change the way the data is indexed and store the fragment along with long fields. (@foresightyj provided good links to exclude / include fields when indexing / querying time)

0
source

Source: https://habr.com/ru/post/1201694/


All Articles