feat:完善项目信息
This commit is contained in:
@ -83,17 +83,25 @@ func TestNewInstance2(t *testing.T) {
|
||||
|
||||
query := elastic.NewBoolQuery()
|
||||
query.Must(elastic.NewMatchQuery("title", "一种"))
|
||||
query.Must(elastic.NewMatchPhraseQuery("industry", "你是"))
|
||||
//query.Must(elastic.NewMatchPhraseQuery("industry", "你是"))
|
||||
|
||||
service := client.Search().Index("es_patent_index")
|
||||
service := client.Search().
|
||||
//Index("es_patent_index")
|
||||
Index("es_manage_index_1")
|
||||
|
||||
result, err := service.From(1).Size(1).TrackTotalHits(true).Pretty(true).Query(query).Do(context.Background())
|
||||
result, err := service.From(0).Size(10).
|
||||
//Explain(true).
|
||||
AllowPartialSearchResults(true).
|
||||
TrackTotalHits(true).
|
||||
TrackScores(true).Query(query).Do(context.Background())
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
t.Log(utils.AnyToJSON(result))
|
||||
t.Log(utils.AnyToJSON(result.Hits.TotalHits.Value))
|
||||
for _, v := range result.Hits.Hits {
|
||||
t.Log(*v.Score)
|
||||
t.Log(string(v.Source))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user