I have an Elasticsearch index, part of it is as follows:
...
},
"entity": {
"properties": {
"DateTime": {
"type": "date"
},
"Event": {
"type": "keyword"
},
"Location": {
"type": "keyword"
},
"Organ": {
"type": "keyword"
},
"Person": {
"type": "keyword"
}
}
},
...
I want to find the most frequent person. So, I query the index in the following ways:
{"size":0, "query":{"match_all":{}},"aggs":{"top_locations":{"terms":{"field":"entity.Person","size":1}}}}
and
{"size":0, "query":{"match_all":{}},"aggs":{"top_locations":{"terms":{"field":"entity.Person.keyword","size":1}}}}
The problem is that the first query works fine, but the second does not work.