假设我有这个给定的数据
{
"name" : "ABC",
"favorite_cars" : [ "ferrari","toyota" ]
}, {
"name" : "ABC",
"favorite_cars" : [ "ferrari","toyota" ]
}, {
"name" : "GEORGE",
"favorite_cars" : [ "honda","Hyundae" ]
}
每当我在搜索最喜欢的汽车是丰田的人时查询此数据时,它都会返回此数据
{
"name" : "ABC",
"favorite_cars" : [ "ferrari","toyota" ]
}, {
"name" : "ABC",
"favorite_cars" : [ "ferrari","toyota" ]
}
结果是两条记录,名称为 ABC。如何仅选择不同的文档?我想要得到的结果只有这个
{
"name" : "ABC",
"favorite_cars" : [ "ferrari","toyota" ]
}
这是我的查询
{
"fuzzy_like_this_field" : {
"favorite_cars" : {
"like_text" : "toyota",
"max_query_terms" : 12
}
}
}
我正在使用 ElasticSearch 1.0.0。使用 java api 客户端