Commit e6bfc3e1 by mushishixian

添加分片优先级

parent 0ada3b17
Showing with 3 additions and 1 deletions
......@@ -98,6 +98,7 @@ func searchAttr(bomItem model.BomItem, search *es.MultiSearchService) (result *e
attrsSlice = append(attrsSlice, attr)
}
}
//fmt.Println(attrsSlice)
query := getQuery(attrsSlice)
//单独针对封装进行转换
if bomItem.Encap != "" {
......@@ -136,7 +137,8 @@ func searchAttr(bomItem model.BomItem, search *es.MultiSearchService) (result *e
source.Sort("_score", false)
source.Sort("brand_sort", true)
source = source.From(0).Size(1)
searchRequest := es.NewSearchRequest().Source(source)
searchRequest := es.NewSearchRequest().Source(source).Preference("_primary")
//fmt.Println(searchRequest.Body())
return search.Add(searchRequest)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment