【发布时间】:2020-07-26 23:12:21
【问题描述】:
我使用的是 Elastic search 5.x,以下代码运行良好:
curl -XPOST "http://localhost:9200/test_index/test_info/_delete_by_query" -d'
{
"query": {
"match": {
"category_id": "21"
}
}
}'
但是当我在我的 php 代码中尝试同样的方法时,它不起作用:
$client->deleteByQuery([
'index' => 'test_index',
'type' => 'test_info',
'query' => [
'match' => [
['category_id' => 21]
]
]
]);
【问题讨论】:
-
您使用的是哪个版本的
elasticsearch-php库? -
@Val 我使用的是 elasticsearch-php 2.0 版
-
好了,你需要使用版本 5 就可以了。
-
@Val ...谢谢...如何在 2.0 版中使用它?
-
看到这个答案:stackoverflow.com/questions/37382980/… 你至少需要 2.4 版
标签: php elasticsearch