-1

I'm fairly new to Elasticsearch so apologies if I am missing something elementary. I am trying to update a field within documents in my index.

POST test_index/_update_by_query
{
  "query": {
    "match": {
      "label": {
        "query": " checked",
        "type": "phrase"
      }
    }
  },
  "script": "ctx._source.status = 'ok'"
}

Looks like it's finding the documents, just doesn't update them. Here is the output in marvel

{
   "ok": true,
   "took": 7531,
   "total": 230954,
   "updated": 0,
   "indices": [
      {
         "test_index": {}
      }
    ]
}

I've installed the plugin at https://github.com/yakaz/elasticsearch-action-updatebyquery as recommended. Any help would be most appreciated. Thanks in advance -

unam
  • 7
  • 1
  • Can you post your elasticsearch mapping? – A Coder Gamer Jun 29 '16 at 23:52
  • Have you [enabled dynamic scripting](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html#enable-dynamic-scripting) as well? – Val Jun 30 '16 at 04:14
  • @AkshayBijawe Sorry not sure what you mean by elasticsearch mapping. Is it the output of GET /test_index/_mappings? – unam Jun 30 '16 at 14:46
  • @Val I had NOT enabled this earlier. Just did and retried but doesn't seem to fix the problem. Thanks for the tip ! – unam Jun 30 '16 at 14:51

1 Answers1

0

Finally figured out what was going on. Had to add another line to the .yml to make this work. Here are the changes I added to the configuration file:

script.inline: true
script.indexed: true
script.disable_dynamic: false

adding the 3rd line makes the difference. thanks for the helpful comments.

unam
  • 7
  • 1