Hey there
I got product data with nested articles and the products got different types.
Now I should search in the product.name and product.description and in the product.articles.gtin
and should retrieve only products with the specified type.
Tried filtered multi_match but got a parse error with that query:
GET products_1_en/_search
{
"query": {
"filtered" : {
"query": {
"multi_match": {
"query": "Bar grills",
"fields": [
"name",
"description",
"articles.gtin"
],
"type": "best_fields"
}
},
"filter": {
"term": {
"type": "ARTICLE_PRODUCT"
}
}
}
}
}
That one is working
GET products_1_en/_search
{
"query":{
"multi_match": {
"query": "Bar grills",
"fields": [
"name",
"description",
"articles.gtin"
],
"type": "best_fields"
}
}
}
but there is no filter and if I search for a gtin number I retrieve no hits.
I there a possibility to do that?
{
"properties":{
"description":{
"type":"text"
},
"id":{
"type":"long"
},
"name":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
},
"type":{
"type":"keyword"
},
"articles":{
"type":"nested",
"properties":{
"description":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
},
"gtin":{
"type":"keyword"
},
"id":{
"type":"long"
},
"name":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
},
"productId":{
"type":"long"
},
"uid":{
"type":"keyword"
}
}
}
}
}
Thanks for help.