Update call with a script doesn't work

(Maged Makled) #1

I have a model message_lists that looks like

threads: nested
  thread_id: text
  read_all: boolean
  messages: nested
    message_id: text
    read: boolean
   body: text

When I run

                                "script": {"inline": "for (thread in ctx._source.threads) { if (thread.thread_id == params.thread_id) { for (message in thread.messages){ if (message.message_id == params.message_id) { thread.read_all = params.read_all; message.read = true;}}}}",
                                 "lang": "painless",
                                 "params": {
                                    "thread_id":  "vvvvvvvvvv",
                                    "message_id":  "wwwwwwwww",
                                    "read_all":  true

The query run with no errors but the read_all field doesn't get set to true, is there something wrong with the query?

(system) #2

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