Elasticsearch对其嵌套文档中的文档进行分页

时间:2016-10-28 09:15:00

标签: elasticsearch

让我们说我有一个人和他们的朋友的文件,我想进行不同的搜索,并对他们的嵌套文件进行分页。我试图找到这个,但我们找不到解决问题的方法。

所以它实际上是我试图解决的第二个和第三个例子。

数据:

[
 {"id":1,"friends": [{"id":11,"name":"A"}, {"id":12,"name": "B"}]},
 {"id":2,"friends": [{"id":21,"name":"A"}, {"id":22,"name": "C"}]},
 {"id":3,"friends": [{"id":31,"name":"A"}, {"id":32,"name": "C"}, {"id":33,"name":"A"}]}
]

1。找到所有朋友

[
  {"id":11,"name":"A"}, {"id":12,"name": "B"}, 
  {"id":21,"name":"A"}, {"id":22,"name": "C"}, 
  {"id":31,"name":"A"}, {"id":32,"name": "C"}, {"id":33,"name":"A"}
]

2。找到所有的朋友大小3

[
  {"id":11,"name":"A"}, {"id":12,"name": "B"}, 
  {"id":21,"name":"A"}
]

第3。找到所有朋友大小3,从4

[
  {"id":22,"name": "C"}, 
  {"id":31,"name":"A"}, {"id":32,"name": "C"}
]

0 个答案:

没有答案