弹性搜索子查询

时间:2017-10-26 04:23:58

标签: mongodb elasticsearch

仍然试图在弹性搜索中搜索连接的表格。我们有mongodb并通过mongo连接器连接到弹性搜索。

我在mongodb有两个相关的集合;人和图像。将有800万人和2000万张图像。一般人们最多有20张图片。如下:

people: [ 
  {
    id: ‘123456abc’,
    name: ‘john’,
    town: ‘San Diego’,
    ssn4: '1234' 
  }, 
  {
    id: ‘919645xyz’,
    name: ‘pete’,
    town: ‘Oxford’,
    ssn4: '1234' 
  }
]

images: [ 
  {
    id: ‘901’,
    contentType: ‘image/tiff’
    documentType: ‘signature’,
    peopleId: ‘123456abc’ 
  }, 
  {
    id: ‘123’,
    contentType: ‘image/tiff’
    documentType: ‘signature’,
    peopleId: ‘123456abc’ 
  },
  {
    id: ‘456’,
    contentType: ‘image/tiff’
    documentType: ‘mail’,
    peopleId: ‘123456abc’ 
  }
]

我希望能够执行一个DSL查询,返回documentType ='signature'的图像,以及生活在'San Diego'镇并且ssn4为'1234'的人(或者奖励,人们)谁的小镇包含'San')。

0 个答案:

没有答案