Hello,
I'm trying to remove one (or more) element from a list in my index, like:
"'_source": {
"id": [
12,
22,
32,
...
]
}
I'm using an update_by_query and a painless script to remove an id in the index if they match one in the given list.
The query repond 'succes': 1 (it's applied tp one doc_type only, I got 10 but I restricted it for debugging purpose), so I guess that my script work and it should! I remember testing it on a small list (10 elements) but not the list is 8500 element long.
Anyway, I'm using the python Elasticsearch Client v 5.1.0 (my cluster is v5.1.4)
Here is the script:
"script": {
"inline":
"""for (int i = 0; i < params.ids_list.length; ++i)"""
"""{"""
""" if (ctx._source.id.contains(params.ids_list[i]))"""
""" {"""
""" ctx._source.id.remove(ctx._source.id.indexOf(params.ids_list[i]))"""
""" }"""
"""}"""
,
'params': {
'id': ids_list
}
},
'query': {
'match_all': {}
}
Thanks for the futur replies.