I have tags field in document, but while indxing I may not have values for tags
field and when tries to add value in it, giving me null pointer
error.
mapping for tags
{
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
update by query using below json
{ "script": { "inline": "ctx._source.tags.addAll(params.tags); ctx._source.updated_on=params.updated_on; "> "params": { "tags": [ "test" ], "updated_on": "2017-06-30T05:06:37.933Z" }, "lang": "painless" }, "query": { "match": { "stone_id": "8822370208" } } }
Is there any way that I can initialize it as an array
I tried to init it using null_value but not working for me
"tags": {
"type": "keyword",
"ignore_above": 256,
"null_value" :
}
or
Is there any way that I can check it is array before updating using script
if not an array-> init as array then use addAll()