0

I need to add a flag with value 2 where the "codigoTema" = 2

The truth is, I'm new to elasticsearch. I would appreciate your help.

I attach my current code. Maybe this is bad because I'm new to this

thank you very much

  POST /lecordonbleu_des/documentos/_update_by_query
    {
        "script": "ctx._source.flag =   2",
        "query": {
            "query_string" : {
                "fields" : ["codigoTema"],
                "query" : "2"
            }
        }
    }
1
  • What doesn't work? What response do you get? Commented Aug 29, 2017 at 4:57

1 Answer 1

1

Try the following syntax for the script:

POST /lecordonbleu_des/documentos/_update_by_query
{
  "script" : 
    {
      "inline": "ctx._source.flag = 2",
      "lang": "painless"
    },
  "query": {
     "query_string" : {
        "fields" : ["codigoTema"],
        "query" : "2"
      }
   }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.