这样看来,_search和_count采取不同格式的查询。例如,这是我的_search
查询:弹性搜索_search与_count语法
{
query: {
filtered: {
query: { match: { Name: "bob" } },
filter: { term: { GroupIds: 3 } }
}
}
}
但是为了_count
理解它,我需要删除外query
:
{
filtered: {
query: { match: { Name: "bob" } },
filter: { term: { GroupIds: 3 } }
}
}
那一个不会与_search
工作。使用_search
与_count
当
{
query: { match: { Name: "bob" } },
filter: { term: { GroupIds: 3 } }
}
那么什么是查询DSL的实际规则:只是为了进一步迷惑我多,_search
会接受它,如果这两个query
和filtered
被删除?
很好的解释Igor,像往常一样! – javanna
感谢您的详细解释。现在变得更有意义了。 –
此答案与早期版本的ES相关。在v1.3.4 Count API现在要求我们在外部查询中打包。 –