I'm working with an Elasticsearch index where I have a mapping that includes a nested field called servicePrices
. Within this nested field, I'm trying to select the top 1 record based on a specific field such as matches
and then filter the selected record based on another field such as price
. Here's a simplified version of my mapping:
{
"services": {
"mappings": {
"properties": {
"id": {
"type": "keyword"
},
"servicePrices": {
"type": "nested",
"properties": {
"age": {
"type": "float"
},
"gender": {
"type": "float"
},
"matches": {
"type": "float"
},
"price": {
"type": "nested",
"properties": {
"amount": {
"type": "float"
},
"currency": {
"type": "keyword"
}
}
}
// Other nested properties...
}
}
}
}
}
}
Could someone provide guidance on how to accomplish this selection, filtering, and inclusion of nested fields