hello ,
I have a nested search .
It is working like this -
GET /products/_search
{
"size": 100,
"query": {
"bool": {
"must": [
{
"nested": {
"path": "owner",
"query": {
"match": { "owner.id": 1 }
}
}
},
]
}
}
}
"hits": [
{
"_index": "products",
"_id": "Mlbyz4kBgvOTcbqQPyPj",
"_score": 3,
"_source": {
"timestamp": "2023-05-31",
"owner": {
"id": 1,
"name": "Bob"
}
}
},
{
"_index": "metric-property-broker-daily-2023-05",
"_id": "NFbyz4kBgvOTcbqQPyPsdfj",
"_score": 3,
"_source": {
"timestamp": "2023-05-04",
"owner": {
"id": 2,
"name": "John"
}
}
},
{
"_index": "metric-property-broker-daily-2023-05",
"_id": "NFbyz4kBgvOTcbqQPyPsdfj",
"_score": 3,
"_source": {
"timestamp": "2023-05-04",
"owner": {
"id": 4,
"name": "Ana"
}
}
},
I wold like to seatch inside in array , something like this -
to bring me all the results that has owner with ids 1 AND 3 .
GET /products/_search
{
"size": 100,
"query": {
"bool": {
"must": [
{
"nested": {
"path": "owner",
"query": {
"match": { "owner.id": [1,3] }
}
}
},
]
}
}
}
how could I do that ?