我有这些文件:
curl -XPOST -H "Content-Type: application/json" "http://localhost:9200/jerewan/product/_search?pretty" -d'
{
{"index":{"_index":"test","_type":"product"}}
{"id_product":"1", "categories":[1,2], "enums":[10,11,20,21] }
{"index":{"_index":"test","_type":"product"}}
{"id_product":"2", "categories":[1,2], "enums":[10,15,25,26] }
{"index":{"_index":"test","_type":"product"}}
{"id_product":"3", "categories":[2,3], "enums":[11,12,13,21,22,23,24] }
}
我需要删除所有具有批量操作的文档的枚举字段中的数字10和11。
因此,输出将在此更新之后进行:
{"id_product":"1", "categories":[1,2], "enums":[20,21] }
{"id_product":"2", "categories":[1,2], "enums":[15,25,26] }
{"id_product":"3", "categories":[2,3], "enums":[12,13,21,22,23,24]
有可能做到吗?
答案 0 :(得分:1)
是的,有可能。
curl -XPOST -H "Content-Type: application/json" "http://localhost:9200/jerewan/product/_search?pretty" -d'
{
{ "update" : {"_id" : "1", "_type" : "product", "_index" : "test"} }
{ "doc" : {"enums" : [20,21]} }
{ "update" : {"_id" : "2", "_type" : "product", "_index" : "test"} }
{ "doc" : {"enums" : [15,25, 26]} }
}
使用此方法,您可以更新以进一步阅读bulk api