Hi,
I'm very new to Elastic so please bear with me.
I have an index with a nested type in it. Let's call it an Index of Person, each of which has an array of type Car. So one person can have many cars. A car has a model, color and year. So something like this:
{
Name: 'Aaron',
Age: 33,
Cars: [{model: 'Forester', color: 'red'}, {model: 'Pinto', color: 'yellow'}, {model: 'Camero', color: 'red'}]
}
So I would like to return all Aaron's red cars.
But my query is returning me all Person's with at least 1 red car, and all of their cars, including the yellow Pinto:
{
query: {nested: {
path: 'Cars'
query: {bool: {
must: {match: {color: 'red'}}
}}
}}
}
I don't see a way to tell it to only return the red cars with the nested data type.
Thanks.
Aaron