1

I'm new to ES and currently evaluating how it would work for us as a backend for storing log data/events. One of the requirements is to bulk update all indexed events and, e.g. add a field.

I looked at the query DSL but I can't find an example for a query that would retrieve all docs which do NOT contain a certain field. The DSL is very expressive when it comes to describing values, but not fieldnames and field existence.

Maybe this is an unusual usecase for typical ES users but I already ran into a real need for it when playing with the ElasticSearch ELK stack. When I inserted data into ES which had the wrong format for Kibana, I got loads of exceptions. Now I wanted to correct the format but I can't retrieve the corrupted documents. Is there a way?

1

1 Answer 1

2

You should be able to use the "exists" filter in conjunction with the "not" filter mentioned above by @touchpad or simply the "missing" filter

  {
   "filter": {
      "not": {
         "exists": {
            "field": <field_name>
         }
      }
   }
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.