my docs looks like this
{ cool_things: [{ name, id }, { name, id }] }
How would I find the id of the one I'm currently in the aggregate. For example this is the query I'm working with.
params.body.aggs = {
uniqueCoolThings: {
terms: {
field: 'cool_things.name.keyword'
},
aggs: {
value: {
top_hits: {
size: 1,
_source: {
includes: ['cool_things.id', 'cool_things.name.keyword']
}
}
}
}
}
}
}
Yet this will return
...hits._source: {
uniqueCoolThings: [
{
"id": 500,
"name": "Bob Sagget"
},
{
"id": 501,
"name": "Matt Damon"
}
]
} ...
I'm wondering how to do a where condition so that it will only return the ID that matches the unique cool_things.name.keyword it is currently on.
I need to get a list of all unique_cool things, and then have their ID's come back with that response (if that makes sense)
Any help would be GREATLY appreciated!!!!