php - PHP + Elasticsearch - 从 Elastic2 到 Elastic6
问题描述
有人可以解释一下这个需要从 Elasticsearch 2 翻译到 Elasticsearch 6 的查询的含义吗?
$query = '{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{ "term": { "pouzivatelId": "5b0e65022a35d13df2236183" } },
{ "term": { "route": "Search:default" } },
{ "term": { "parametre.hladat": 1 } }
]
}
}
}
}
}';
$resp = $this->elastica->request('log/user/_search/exists', Elastica\Request::POST, json_decode($query, true))
->getData();
我不明白一些事情。
- 网址 - 用户。我认为这是对 _type 的查询
- 网址 - 存在部分。我找不到这方面的文档
- 查询 - 它与 Elastic 6 兼容吗?
谢谢你。
解决方案
- 这将起作用,日志是索引,用户是类型。请注意,如果您转到 es 6.0,则只能使用一种映射类型(https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html)。2.x 到 6.x 之间的映射也发生了变化,但这不是你的问题。
- 使用: size=0&terminate_after=1 代替(https://www.elastic.co/guide/en/elasticsearch/reference/5.5/break_50_search_changes.html),存在已被删除。
不,试试这个:
$query = '{ "query": { "bool": { "must": [ { "term": { "pouzivatelId": "5b0e65022a35d13df2236183" } }, { "term": { "route": "Search:default " } }, { "term": { "parametre.hladat": 1 } } ] } } }';
推荐阅读
- javascript - 如何在javascript中存储带有值的id?
- javascript - 向用户显示键入的值,但在表单值 React js 中进行一些计算
- amazon-web-services - SSL证书在laravel项目aws中不起作用
- python - 如何找到numpy数组中图像的差异?
- windows-subsystem-for-linux - 如何在 WSL2 ubuntu 18.04 中重新挂载 rootfs?
- python - 如何在 Windows 中禁用 python 后重新启用通知?
- python - 在 QGraphicsScene (Pyqt) 中调整自定义项目大小的问题
- qt - 将所有文件名从文件夹中获取到 QT 中的滚动区域
- c - 如何解决 C 中的指针转换以避免未对齐的内存访问?
- node.js - 无法安装 reactstrap