瀏覽代碼

fix:aggs聚合优化

duxin 2 年之前
父節點
當前提交
bd5a47dca8
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      entity/search/marketAnalysisEntity.go

+ 4 - 0
entity/search/marketAnalysisEntity.go

@@ -12,6 +12,10 @@ const (
 	//中标单位分布
 	winner_procurement_scale = `"winner_amount_distribution": {"terms": {"field": "entidlist","size": 0},"aggs": {"amount": {"sum": {"field": "sortprice"}}}}`
 
+	//可能会用到的优化语句 现在保持与定制化页面一直 如需优化 两边修改es查询 使用下边两个查询
+	buyerScale   = `"buyer_distribution": {"filter": {"exists": {"field": "%s"}},"aggs": {"sort_str": {"range": {"field": "sortprice","ranges": [%s]},"aggs": {"amount": {"sum": {"field": "sortprice"}},"area_count": {"filter": {}}}}}}`
+	sortPriceStr = `{"key":"<10万","from":0.0000000000001,"to":100000},{"key":"10万-50万","from":100000,"to":500000},{"key":"50万-100万","from":500000,"to":1000000},{"key":"100万-500万","from":1000000,"to":5000000},{"key":"500万-1000万","from":5000000,"to":10000000},{"key":"1000万-1亿","from":10000000,"to":100000000},{"key":"≥1亿","from":100000000}`
+
 	localMultiMatch     = `{"multi_match": {"query": %s,"type": "phrase", "fields": [%s]}}`
 	query_bool_must_and = `{"bool": {"must": [%s]%s}}`
 	PSearch_DecMust     = `"bidstatus": ["中标","成交","合同","单一"]`