-
-
Save ncolomer/a58042b363f2efdc5f88 to your computer and use it in GitHub Desktop.
Product/price nested query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"size": 16, | |
"query": { | |
"filtered": { | |
"query": { | |
"match_all": {} | |
}, | |
"filter": { | |
"nested": { | |
"path": "prices", | |
"query": { | |
"filtered": { | |
"query": { | |
"match_all": {} | |
}, | |
"filter": { | |
"range": { | |
"price": { | |
"lte": 100 | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"partial_fields": { | |
"partial1": { | |
"exclude": "prices.*" | |
} | |
}, | |
"sort": [ | |
{ | |
"prices.priceSort": { | |
"order": "asc", | |
"mode": "min", | |
"nested_filter": { | |
"range": { | |
"price": { | |
"lte": 100 | |
} | |
} | |
} | |
} | |
} | |
], | |
"facets": { | |
"priceStats": { | |
"statistical": { | |
"field": "price" | |
}, | |
"facet_filter": { | |
"range": { | |
"price": { | |
"lte": 100 | |
} | |
} | |
}, | |
"nested": "prices" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"size": 16, | |
"query": { | |
"filtered": { | |
"query": { | |
"match_all": {} | |
}, | |
"filter": { | |
"nested": { | |
"path": "prices", | |
"query": { | |
"filtered": { | |
"query": { | |
"match_all": {} | |
}, | |
"filter": { | |
"term": { | |
"categoryId": 18 | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"partial_fields": { | |
"partial1": { | |
"exclude": "prices.*" | |
} | |
}, | |
"sort": [ | |
{ | |
"prices.priceSort": { | |
"order": "asc", | |
"mode": "min", | |
"nested_filter": { | |
"term": { | |
"categoryId": 18 | |
} | |
} | |
} | |
} | |
], | |
"facets": { | |
"priceStats": { | |
"statistical": { | |
"field": "price" | |
}, | |
"facet_filter": { | |
"term": { | |
"categoryId": 18 | |
} | |
}, | |
"nested": "prices" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment