I need to translate OLD queries from ES2.0 to ES6.1 ... and it seems not easy at all ... the original one is :
{
"size":0,
"query": {
"bool": {
"filter": {
"bool": {
"must": {
"query": {
"match": {
"my_hits": {
"query": 0,
"type": "phrase"
}
}
}
}
}
}
}
},
"fields": "ip",
"aggregations": {
"par_ip": {
"terms": {
"field": "ip",
"min_doc_count": 2,
"size": 10000,
"order": {
"_term": "asc"
}
}
}
}
}
I think that the first part could be converted to :
{
"size": 0,
"query": {
"match" : {
"my_hits": "0"
}
}
}
but for the rest I am stuck ...
"type": "illegal_argument_exception", "reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [ip] 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."
EDIT : I think you will need thoses informations :
"mappings": { ...
"ip": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
Thanks for your help ! Stéphane
"fields": "ip"line that is causing the trouble. Try removing it? If it works, try with"fields": "ip.keyword"- Archit Saxena