How to update a field data of all doc in an index in elasticsearch

I need to update a 'Decision" filed in tdcorescalio index . But i geeting belwo error.

Mapping:

{"tdcorescaleio":{"mappings":{"scaleio":{"properties":{"Decision":{"type":"keyword"}}},"tdcorescaleio":{"properties":{"Decision":{"type":"keyword"},"date":{"type":"date"},"doc":{"properties":{"Decision":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}}}},"query":{"properties":{"match_all":{"type":"object"}}},"size":{"type":"long"},"sort":{"properties":{"date":{"properties":{"order":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}}}}}}}}}}}  

Error:

curl -X POST "localhost:9200/tdcorescaleio/tdcorescaleio/_update_by_query?pretty" -H 'Content-Type: application/json' -d'
{
"query": { "match_all": {} },
    "doc": { "Decision": "NA" }
}'
{
  "error" : {
    "root_cause" : [
      {
        "type" : "parsing_exception",
        "reason" : "Unknown key for a START_OBJECT in [doc].",
        "line" : 4,
        "col" : 12
      }
    ],
    "type" : "parsing_exception",
    "reason" : "Unknown key for a START_OBJECT in [doc].",
    "line" : 4,
    "col" : 12
  },
  "status" : 400
}

Let me know the exact query to update a particular field in all docs

As written in documentation, do something like:

PUT _ingest/pipeline/set-foo
{
  "description" : "sets foo",
  "processors" : [ {
      "set" : {
        "field": "foo",
        "value": "bar"
      }
  } ]
}
POST twitter/_update_by_query?pipeline=set-foo

Thanks it is working....

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.