I have below types documents.
{
"_index": "example1",
"_type": "doc",
"_id": "8036",
"_score": 1,
"_source": {
"user": "kimchy8036",
"postDate": "2009-11-15T13:12:00",
"locations": [
[
72.79887719999999,
21.193036000000003
],
[
-1.8262150000000001,
51.178881999999994
]
]
}
}
And below is mapping:
{
"example1": {
"mappings": {
"doc": {
"properties": {
"locations": {
"type": "geo_point"
},
"postDate": {
"type": "date"
},
"status": {
"type": "long"
},
"user": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
I can add multiple locations using below query.
POST /example1/_update_by_query
{
"query": {
"match": {
"_id": "3"
}
},
"script" : {
"lang":"painless",
"inline": "ctx._source.locations.add(params.newsupp)",
"params":{
"newsupp":[-74.00,41.12121 ]
}}
}
But not able remove array objects from locations. I have tried below query but not working.
POST example1/doc/3/_update
{
"script" :
{
"lang":"painless",
"inline":"ctx._source.locations.remove(params.tag)",
"params":{
"tag":[-74.00,41.12121]
}
}
}
Kindly let me know where i am doing wrong here. I am using elastic version 5.5.2