but running this comand, return e following error:
`{"took":1019,"timed_out":false,"_shards":
{"total":17,"successful":12,"skipped":0,"failed":5,"failures":
[{"shard":0,"index":"imsva_message","node":"NYJSJOgHTXCdT8OW73dAxQ","reason" :
{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by
default. Set fielddata=true on [remetente] in order to load fielddata in memory by
uninverting the inverted index. Note that this can however use significant memory.
Alternatively use a keyword field instead."}}]},"hits":{"total":11585745,"max_score":0.0,"hits":
[]},"aggregations":{"group_by_state":
{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[]}}}
The problem here is that you are trying to do Terms Aggregation over an analyzed field, which is not supported by default.
There are two possible workarounds here:
Aggregate over a keyword field instead of text. If you have used standard dynamic mapping then you probably have the remetente.keyword field. Try aggregating over this field. If this does not exists, then you need to create a field of type keyword and use that field for aggregation.
If you really need to aggregate over an analyzed field (i.e. of type text) then you can still do it by setting fielddata: true in this remetente field mapping. But keep in mind that this can potentially use lots of heap memory which will lead to GC pressure and cause performance issues.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.