【发布时间】:2015-02-07 19:41:27
【问题描述】:
我在弹性搜索中复制 MySQL 删除查询时遇到问题,我正在使用以下文档:http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-delete-by-query.html using the PHP wrapper for Laravel。
我正在尝试这个:
$this->es->deleteByQuery([
'index' => 'users',
'type' => 'user',
'body' => [
'query' => [
'term' => ['field1' => $this->field1],
'term' => ['field2' => $this->field2],
'term' => ['temp' => 0]
]
]
]);
假设是 DELETE FROM users WHERE field1 = $this->field1 AND field2 = $this->field2...
我在将 WHERE AND 语法转换为 Elastic Search 时遇到问题。
有什么帮助吗?
【问题讨论】:
-
使用
bool查询来组合条款。 -
我想我现在已经过火了。我有身体 => 查询 => 过滤器 => 过滤 => 布尔 => 必须 => 术语、术语、术语。我需要过滤器 => 过滤后的数组吗?
-
你不需要过滤器。有一个没有过滤器的布尔查询:elasticsearch.org/guide/en/elasticsearch/reference/current/…
-
很酷,谢谢!它有效。
标签: php mysql laravel elasticsearch