[英]ElasticSearch- “No query registered for…”
ElasticSearch returns me "No query registered for [likes_count]" error when trying to look up entries using the following query. 当尝试使用以下查询查找条目时,ElasticSearch返回“没有为[likes_count]注册的查询”错误。 The field likes_count is a new field of documents and does not exist in every document.
字段likes_count是一个新的文档字段,并不存在于每个文档中。
The same query works without the sort part. 相同的查询无需排序部分。
Why does this error appear? 为什么会出现此错误?
Thanks 谢谢
{
"query": {
"filtered": {
"query": {
"query_string": {
"fields": ["description"],
"query": "sun"
},
"sort": [{
"likes_count": {
"unmapped_type": "boolean",
"order": "desc",
"missing": "_last"
}
}]
},
"filter": {"term": {"permissions": 1}}
}
}
}
Write your query like this, ie sort
needs to go to the top-level and not nested in the query
part: 像这样编写你的查询,即
sort
需要转到顶层而不是嵌套在query
部分:
{
"query": {
"filtered": {
"query": {
"query_string": {
"fields": [
"description"
],
"query": "sun"
}
},
"filter": {
"term": {
"permissions": 1
}
}
}
},
"sort": [
{
"likes_count": {
"unmapped_type": "boolean",
"order": "desc",
"missing": "_last"
}
}
]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.