I am having the following code to delete the docs from elasticsearch .
public function deleteByQuery(){
$client = $this->_connectElasticSearchClient();
$params = [
'index' => $this->_indexName,
'type' => $this->_typeName,
'body' => [
'query' => [
'match' => [
'brand' => 'apple'
]
]
]
];
$response = $client->deleteByQuery($params);
print_r($response);die;
}
I am getting the following as response.
{
"found": false,
"_index": "gadgets",
"_type": "products",
"_id": "_query",
"_version": 1,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
}
}
Tried changing the query string and all.but no use. While searching with the above query ,I am getting data also.
I am using Elasticsearch-PHP Client.
Since you're using Elasticsearch 2.1, you need to know that the delete-by-query feature has been removed from the core and moved into a dedicated plugin .
You need to install that plugin first in order for your PHP code to work.
./bin/plugin install delete-by-query
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.