Я использую elasticsearch версии 1.2.1.
Сохраненное значение для атрибута - shoes
, а анализатор поля - снежный ком, и, несмотря на все это, ES не находит его, когда я ищу shoes
. Когда я ищу shoe
, он находит документ...
Это мой запрос:
{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"or": [
{
"term": {
"category": "shoes"
}
},
{
"term": {
"sub_category1": "shoes"
}
},
{
"term": {
"sub_category2": "shoes"
}
},
{
"term": {
"brand": "shoes"
}
},
{
"term": {
"shop": "shoes"
}
}
]
}
}
},
"aggregations": {
"category": {
"terms": {
"field": "category"
}
},
"sub_category1": {
"terms": {
"field": "sub_category1"
},
"aggregations": {
"discount": {
"avg": {
"field": "discount_percentage"
}
}
}
}
}
}
Это мое отображение:
"mappings": {
"item": {
"properties": {
"brand": {
"type": "string",
"analyzer": "snowball"
},
"category": {
"type": "string",
"analyzer": "snowball"
},
"color": {
"type": "string"
},
"created_at": {
"type": "date",
"format": "dateOptionalTime"
},
"discount_percentage": {
"type": "long"
},
"domain_name": {
"type": "string"
},
"id": {
"type": "long"
},
"image": {
"type": "string"
},
"item_name": {
"type": "string"
},
"link": {
"type": "string"
},
"need_indexing": {
"type": "boolean"
},
"price": {
"type": "string"
},
"price_range": {
"type": "string"
},
"product_key": {
"type": "string"
},
"raw_size": {
"type": "string"
},
"regular_price": {
"type": "string"
},
"sale_price": {
"type": "string"
},
"scrape_run": {
"type": "string"
},
"shop": {
"type": "string",
"analyzer": "snowball"
},
"size": {
"type": "string"
},
"source_url": {
"type": "string"
},
"sub_category1": {
"type": "string",
"analyzer": "snowball"
},
"sub_category2": {
"type": "string",
"analyzer": "snowball"
},
"updated_at": {
"type": "date",
"format": "dateOptionalTime"
}
}
}
}
}