Let's say I have this given data
{
"name" : "ABC",
"favorite_cars" : [ "ferrari","toyota" ]
}, {
"name" : "ABC",
"favorite_cars" : [ "ferrari","toyota" ]
}, {
"name" : "GEORGE",
"favorite_cars" : [ "honda","Hyundae" ]
}
Whenever I query this data when searching for people who's favorite car is toyota, it returns this data
{
"name" : "ABC",
"favorite_cars" : [ "ferrari","toyota" ]
}, {
"name" : "ABC",
"favorite_cars" : [ "ferrari","toyota" ]
}
the result is Two records of with a name of ABC. How do I select distinct documents only? The result I want to get is only this
{
"name" : "ABC",
"favorite_cars" : [ "ferrari","toyota" ]
}
Here's my Query
{
"fuzzy_like_this_field" : {
"favorite_cars" : {
"like_text" : "toyota",
"max_query_terms" : 12
}
}
}
I am using ElasticSearch 1.0.0. with the java api client