假设我有一个看起来像这样的记录:搜索所有字段嵌套对象ElasticSearch
{
"title": "Random title",
"authors": [
{
"first": "Jordan",
"last": "Reiter"
… more fields here …
},
{
"first": "Joe",
"last": "Schmoe"
… more fields here …
},
]
}
我希望用户能够按作者搜索记录,如果他们进入全面查询约旦Reiter它拉起这个记录(和其他至少有一个作者匹配这些字段的其他人)。
我不希望用户必须指定第一个/最后一个字段,我不一定知道他们是否搜索Jordan Reiter
Reiter Jordan
甚至J Reiter
如此理想,我想匹配所有这些情况,同时仍然过滤它使,例如,这些记录与匹配:
{
"title": "About Jordan Reiter",
"authors": [
{
"first": "Susan",
"last": "Schmusan"
… more fields here …
}
]
}
{
"title": "Completely different authors",
"authors": [
{
"first": "Robert",
"last": "Jordan"
… more fields here …
},
{
"first": "Samuel",
"last": "Reiter"
… more fields here …
},
]
}
在ElasticSearch刚刚起步,所以如果有一个基本的概念,我很想念让我知道。
我打算让作者字段为嵌套类型。在第一个和最后
是的,这将做到这一点。我没有意识到你可以搜索字段列表。但是,我将它作为嵌套查询搜索来完成。从这里回答:http://stackoverflow.com/a/17937816/255918 –