Skip to main content

append values to an array in elasticsearch

PUT updateindextest/type1/1
{
    "counter" : 1,
    "roka" : ["red"]
}

PUT updateindextest/type1/2
{
    "counter" : 2,
    "roka" : ["sdf"]
}


POST /updateindextest/type1/_update_by_query?pretty
{
  "script": {
"inline": "ctx._source.roka.add(params.hits)",
"params": {"hits": "pila"}
  },
  "query": {
"match_all": {}
}
}

GET updateindextest/_search?pretty
{
  "query": {
    "match_all": {}
  }
}


Comments