hi i developing server
this time we apply Atlas cluster and AtlasSearch
so need test Search
my code like this
func (m *MarketDB) Test() {
text := "WROSship"
pipeLine := []bson.M{
{"$search": bson.M{
"index": NFT_INDEX,
"text": bson.M{
"query": text,
"path": []string{"searchKeyword"},
},
}},
}
ctx := context.Background()
if cursor, err := m.nfts.Aggregate(ctx, pipeLine, options.Aggregate()); err != nil {
panic(err)
} else {
defer cursor.Close(ctx)
var nfts []*types.Nft
if err = cursor.All(ctx, &nfts); err != nil {
panic(err)
} else {
fmt.Println(len(nfts))
}
}
}
nfts collection’s total Document is 13M
and that query result count is 35000
but it takes 30s
what is my fault??
my search index like this
{
"mappings": {
"dynamic": false,
"fields": {
"searchKeyword": {
"analyzer": "lucene.standard",
"type": "string"
}
}
}
}
and searchKeyword like this
WM4CHA 1285 0xc234e58cb077ccf4fbe57d3ac27db0d1cdfe0473 Taoist
thank to read