Update by query¶
Updating documents matching a query¶
Replace the match_all
query with any query that you would like.
POST /products/_update_by_query
{
"script": {
"source": "ctx._source.in_stock--"
},
"query": {
"match_all": {}
}
}
Ignoring (counting) version conflicts¶
The conflicts
key may be added as a query parameter instead, i.e. ?conflicts=proceed
.
POST /products/_update_by_query
{
"conflicts": "proceed",
"script": {
"source": "ctx._source.in_stock--"
},
"query": {
"match_all": {}
}
}
Matches all of the documents within the products
index¶
GET /products/_search
{
"query": {
"match_all": {}
}
}