My es version info:
{
"version": {
"number": "7.7.1",
"build_flavor": "default",
"build_type": "tar",
"build_hash": "ad56dce891c901a492bb1ee393f12dfff473a423",
"build_date": "2020-05-28T16:30:01.040088Z",
"build_snapshot": false,
"lucene_version": "8.5.1",
"minimum_wire_compatibility_version": "6.8.0",
"minimum_index_compatibility_version": "6.0.0-beta1"
}
}
My index info:
{
"sh_xxx_xxx_sku_prd_20210329": {
"aliases": {
"sh_xxx_xxx_sku": {}
},
"mappings": {
"dynamic": "false",
"properties": {
"id": {
"type": "keyword"
},
"price": {
"type": "double"
},
"shopId": {
"type": "keyword"
},
"shopName": {
"type": "text"
},
"supplierAttrIds": {
"type": "keyword"
},
"supplierId": {
"type": "integer"
},
"supplierProductCommissionRate": {
"type": "double"
},
"supplierProductId": {
"type": "integer"
},
"supplierProductPerformanceRate": {
"type": "double"
},
"supplierStyleAttrId": {
"type": "long"
}
}
},
"settings": {
"index": {
"refresh_interval": "30s",
"number_of_shards": "5",
"translog": {
"flush_threshold_size": "512mb",
"sync_interval": "60s",
"durability": "async"
},
"provided_name": "sh_xxx_xxx_sku_prd_20210329",
"creation_date": "1617012644280",
"number_of_replicas": "1",
"uuid": "fIyF13TBRNmhuIchQX8M5Q",
"version": {
"created": "7070199"
}
}
}
}
}
my search body:
{
"query": {
"bool": {
"must": [
{
"match": {
"shopName": {
"query": "飞帆运动"
}
}
},
{
"exists": {
"field": "supplierStyleAttrId"
}
},
{
"range": {
"supplierStyleAttrId": {
"from": 0,
"include_lower": false,
"include_upper": true,
"to": null
}
}
}
]
}
},
"size": 0,
"aggs": {
"supplierStyleAttrId": {
"aggregations": {
"price": {
"min": {
"field": "price"
}
},
"r_bucket_sort": {
"bucket_sort": {
"size": 5000
}
},
"supplierProductCommissionRate": {
"avg": {
"field": "supplierProductCommissionRate"
}
},
"supplierProductPerformanceRate": {
"avg": {
"field": "supplierProductPerformanceRate"
}
}
},
"terms": {
"field": "supplierStyleAttrId",
"order": [
{
"supplierProductCommissionRate": "desc"
}
],
"size": 5000
}
}
}
}
with the request body above, i got docs with shopName is not "飞帆运动", why can this happen?
by the with the request body below, i got the right result
{
"query": {
"bool": {
"must": [
{
"match": {
"shopName": {
"query": "飞帆运动"
}
}
},
{
"exists": {
"field": "supplierStyleAttrId"
}
},
{
"range": {
"supplierStyleAttrId": {
"from": 0,
"include_lower": false,
"include_upper": true,
"to": null
}
}
}
]
}
},
"aggs": {
"supplierStyleAttrId": {
"aggregations": {
"price": {
"min": {
"field": "price"
}
},
"r_bucket_sort": {
"bucket_sort": {
"size": 5000
}
},
"scoreMax": {
"max": {
"script": {
"lang": "painless",
"source": "_score"
}
}
},
"supplierProductCommissionRate": {
"avg": {
"field": "supplierProductCommissionRate"
}
},
"supplierProductPerformanceRate": {
"avg": {
"field": "supplierProductPerformanceRate"
}
}
},
"terms": {
"field": "supplierStyleAttrId",
"order": [
{
"scoreMax": "desc"
}
],
"size": 5000
}
}
}
}