|
@@ -63,16 +63,16 @@ func SearchChartCollectData(indexName, keywordStr string, userId int, permission
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- /*mustMap = append(mustMap, map[string]interface{}{
|
|
|
- "bool": shouldMap,
|
|
|
- })*/
|
|
|
-
|
|
|
+ boolMap := map[string]interface{}{
|
|
|
+ "must": mustMap,
|
|
|
+ }
|
|
|
+ if len(shouldItemMap) > 0 {
|
|
|
+ boolMap["should"] = shouldItemMap
|
|
|
+ boolMap["minimum_should_match"] = 1
|
|
|
+ }
|
|
|
queryMap := map[string]interface{}{
|
|
|
"query": map[string]interface{}{
|
|
|
- "bool": map[string]interface{}{
|
|
|
- "must": mustMap,
|
|
|
- "should": shouldItemMap,
|
|
|
- },
|
|
|
+ "bool": boolMap,
|
|
|
},
|
|
|
}
|
|
|
jsonBytes, _ := json.Marshal(queryMap)
|