feat:完善项目信息

This commit is contained in:
henry
2022-01-20 15:49:44 +08:00
parent b87cd837be
commit bfa9af1654
8 changed files with 110 additions and 11 deletions

View File

@ -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))
}
}