Search This Blog

Elasticsearch - How to add new field to existing document by update by query

     Elasticsearch: Backfill old documents with email
 
 
You can use the update by query API in order to add a new field to all your existing documents:

POST index/_update_by_query
{
  "script": {
    "source": "ctx._source.email = 'rohitpatel0105@gmail.com'",
    "lang": "painless"
  },
  "query": {
    "bool": {
      "must_not": [
        {
          "exists": {
            "field": "email"
          }
        }
      ]
    }
  }
}

No comments:

Post a Comment

Are You A Thinker Or Maybe It's Overflowing?

Hi, everybody. I'm Rohit Patel and I'd like to ask you today, "Are you a thinker Or maybe it's overflowing? Do you live in ...

Popular Posts