I have a index with some nested informations and right now struggle with how make to make a query.
The index below represents a car piece and this piece belongs to 2 cars.
{
"_index": "items_production_20180411115923024",
"_type": "item",
"_id": "1232",
"_score": 21.715849,
"_source": {
"description": "CUBO RODA TRASEIRA VW:GOL, VOYAGE G5/G6 09> C/ABS",
"observation": null,
"brand_id": "1 ",
"product_line_id": "13",
"line_id": "1",
"line": "Rolamentos",
"segment_id": "21",
"segment": "cubo de roda",
"application_features": [
"4 furos"
],
"original_codes": [
" 5u0 501 611 "
],
"original_brands": [
"volkswagen"
],
"vehicles": [
{
"id": "285",
"brand": "volkswagen",
"name": "golf",
"years": [
"2009",
"2010",
"2011",
"2012",
"2013",
"2014",
"2015",
"2016",
"2017",
"2018"
]
},
{
"id": "345",
"brand": "volkswagen",
"name": "jetta",
"years": [
"2015",
"2016",
"2017",
"2018"
]
}
]
}
}
I have to make the query match to one single result when search for the model and year of a car. Ie:
GET items_production_20180411115923024/_search
{
"query":{
"bool":{
"must":{
"multi_match":{
"query":"golf 2010",
"type":"cross_fields",
"operator":"and",
"fields":[
"vehicles.name^8",
"vehicles.years^8"
]
}
}
}
},
"size":10,"from":0
}
I have to return all docs wich are pieces of a golf year 2010. But my response is none?
What I'm doing wrong? How can I make this query?