I have an index with the following mapping:
"properties": {
"content": {
"type": "text",
},
"ar_name": {
"type": "text"
}
}
I want to get statistics (min length, max length and average length) to the content
field.
How can I do it ?
>Solution :
The string_stats aggregation provides that support but only for keyword fields. Since your content field is of type text, I assume it contains free-text that is not really suitable as keyword.
If that’s the case, I would suggest that you stored the length of the content field in another integer field (e.g. content_length) that you can then use in a stats aggregation that would return you the metrics you expect.