Posts

Showing posts with the label Field

Best Way To Check If A Field Exist In An Elasticsearch Document

Answer : You can use the exists filter combined with a bool/must filter like this: { "query": { "filtered": { "filter": { "bool": { "must": [ { "exists": { "field": "price" } }, ... <-- your other constraints, if any ] } } } } } DEPRECATED (since ES5) You can also use the missing filter combined with a bool/must_not filter: { "query": { "filtered": { "filter": { "bool": { "must_not": [ { "missing": { "field": "price" } } ] } } } } } The exists filter has been replaced by exists query from ES 2.1, though the working of it is the same. Also, t...