我在ES中使用percolate查询。但我没有合并bool查询和排序查询:
我的目的: 今天对添加产品的价格进行排序。
我现有的索引
PUT /product-alert
{
"mappings": {
"doctype": {
"properties": {
"product_name": { "type": "text" },
"price": { "type": "double"},
"user_id": { "type": "integer" },
"date" : { "type": "date" }
}
},
"queries": {
"properties": {
"query": {
"type": "percolator"
}
}
}
}
}
我有以下错误。
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "mapper [sort] of different type, current_type [text], merged_type [ObjectMapper]"
}
],
"type": "illegal_argument_exception",
"reason": "mapper [sort] of different type, current_type [text], merged_type [ObjectMapper]"
},
"status": 400
}
弹性查询:
PUT /product-alert/queries/1?refresh
{
"query": {
"bool": {
"must": [
{
"query_string": {
"query": "(product_name:iphone)"
}
},
{
"range": {
"created_at": {
"gte": "2017-05-12",
"lte": "2017-05-12",
"include_lower": true,
"include_upper": true
}
}
}
]
}
},
"from": 0,
"size": 200,
"sort": [
{
"price": {
"order": "asc"
}
},
"_score"
]
}
我的错在哪里?排序工作'排序':'_得分',但它对我来说是恶作剧。
提前致谢