【发布时间】:2014-12-19 21:07:25
【问题描述】:
我有两个字段,文本和大小的对象:
{"text":"example text", "size":"0"}
{"text":"some text for example", "size":"1"}
{"text":"other text for example", "size":"1"}
{"text":"example with different size", "size":"2"}
{"text":"just an example", "size":"2"}
例如,我使用match 查询“示例”,因此所有对象都将被匹配。接下来,我想过滤那些具有最大size 字段值的那些,在这种情况下为 2。
最大值应仅用于匹配的字段。因此,如果我搜索仅匹配大小为 1 的前两行的“文本”,则对象应由 size == 1 过滤。
我可以通过两个查询来获得它,第一个是获取最大值,第二个是过滤,但是可以在一个查询中做到这一点吗?
【问题讨论】:
标签: elasticsearch