ElasticSearch过滤具有相同术语的多种文档
我不确定如何描述此查询,因此不知道在文档中查找什么.我将尝试用一个虚构的示例进行演示.
I'm not sure how to describe this query so don't know what to look for in the documentation. I will try and demonstrate with a made up example.
您拥有带序列号的电子设备清单"serial":"xyz"
You have an inventory of electronic devices with serial numbers
"serial": "xyz"
它们都具有状态,例如
状态":有问题"
或
状态":已修复"
可以有多个具有相同序列号的文档.例如
There can be multiple documents with the same serial number. E.g.
{"serial":"xyz"状态":有问题"日期":2015年1月1日}
,然后再发送另一个文档
and then another doc at a later date
{"serial":"xyz"状态":已修复"日期":2015年1月2日}
因此,我想搜索索引以显示所有序列号,其中存在状态为故障"的文档和状态为已修复"的文档.该查询的类型是什么?
So i want to search my index to show me all serial numbers where there exists a document with status "faulty" AND a document with status "repaired". What is the type of query for that?
只是好奇地检查此查询是否满足您的需求:
just curious to check if this query satisfies your need:
{
"query": {
"query_string": {
"query": "status:faulty OR status:repaired"
}
}
}