I am new to Elastic Search, and my data has the form:
Index Mapping
{
"company:product:index": {
"aliases": {},
"mappings": {
"company:product:mapping": {
"properties": {
"attribute_heel-style": {
"properties": {
"label": {
"type": "keyword"
},
"name": {
"type": "keyword"
},
"source": {
"type": "keyword"
},
"value": {
"type": "keyword"
},
"value_label": {
"type": "keyword"
}
}
}
}
}
}
}
}
Index Data
{
"attribute_heel-style": [
{
"name": "heel-style",
"label": "Heel Style",
"value": "stiletto",
"value_label": "Stiletto"
},
{
"name": "heel-style",
"label": "Heel Style",
"value": "wedge"
"value_label": "Wedge"
},
... // a bunch of other objects in this array as well
]
}
I'd like to create a query so that I can filter all objects within the array who have the value "Wedge" for the key "value_label". How can I do this?
Edit: Found the solution! Posting below. Thank you to @EsCoder.
{
"query": {
"bool": {
"filter": [
{
"bool": {
"must": [
{
"term": {
"attribute_heel-style.value_label": "wedge"
}
}
]
}
}
]
}
}
}