DSL 语句:
GET /idx_sku_statistics_index/sku_index/_search { "from" : 0, "size" : 100, "query" : { "bool" : { "must":[ { "range" : { "salePrice" : { "from" : 1.9, "to" : 2.1, "include_lower": true, "include_upper": true } } } , { "bool": { "must": { "term": { "cityId": 136 } } } } ] } }, "sort": [ { "salePrice": "asc" } ] }
解释说:
range: 表示范围查询;
salePrice: 针对salePrice字段做范围查询;
include_lower 做>= 查询还是 > 查询; true 就是 >=
include_upper 做<= 查询还是 < 查询; true 就是 <=
sort 表示排序数组: 可以根据多个字段字段; 当前是根据salePrice 做顺序排序