我们有20万条记录。首次运行搜索查询时,大小为:500我正在doc-1,doc-2,doc-3中获得结果。但是,当我第二次运行相同的搜索查询时,却将顺序更改为doc-2,doc-1等……为什么每次我们运行相同的查询时搜索结果顺序都会有所不同?
查询:{“解释”:true,“大小”:500,“查询”:{“query_string”:{“查询”:“(((NAME:\” BANK AMERICA \“))^ 50 OR(Names.Name :( BANK AMERICA))^ 30 OR(NAME_PAIR:\“BANK AMERICA \”)^ 30 OR(NORMAL_NAME:(BANK AMERICA)AND CITY:\“\”)^ 40 OR(NORMAL_NAME:(BANK AMERICA))^ 30 OR( Styles.value:\“BS \”)^ 5 OR(NORMAL_NAME:\“BANK AMERICA \”)^ 5 OR(address.streetName:\“\” AND CITY:\“\”)^ 30 OR(ZIP:\ “\”)^ 6 OR(address.streetName:\“\”)^ 6 OR(address.streetNumber:\“\” AND address.streetName:\“\”)^ 15 OR(telephones.telephone:\“\ “)^ 50 OR(mailAddresses.postbox:\” \“)^ 6)”}},“sort”:[{“_ score”:{“order”:“desc”}}},{“statusIndicator”:{“order“:” asc“}}],” aggs“:{” NAME“:{” filter“:{” term“:{” NAME“:” ATLS“}}}}}
当运行上面的结果是:
“点击数”:{
“总计”:106421,
“max_score”:null,
“点击数”:[
{
“_shard”:0,
“_node”:“1”,
“_index”:“allocation_e1”,
“_type”:“my_type”,
“_id”:“217600050_826_E1”,
“_score”:2.9569159,
“_routing”:“E1”,
“_资源”: {
“sample_number”:217600050,
“国家/地区代码”:101,
“state”:“E1”,
“名称”:“AMERICA Plc的银行”,
再次破坏相同的查询时,结果是:
查询:{“解释”:true,“大小”:500,“查询”:{“query_string”:{“查询”:“(((NAME:\” BANK AMERICA \“))^ 50 OR(Names.Name :( BANK AMERICA))^ 30 OR(NAME_PAIR:\“BANK AMERICA \”)^ 30 OR(NORMAL_NAME:(BANK AMERICA)AND CITY:\“\”)^ 40 OR(NORMAL_NAME:(BANK AMERICA))^ 30 OR( Styles.value:\“BS \”)^ 5 OR(NORMAL_NAME:\“BANK AMERICA \”)^ 5 OR(address.streetName:\“\” AND CITY:\“\”)^ 30 OR(ZIP:\ “\”)^ 6 OR(address.streetName:\“\”)^ 6 OR(address.streetNumber:\“\” AND address.streetName:\“\”)^ 15 OR(telephones.telephone:\“\ “)^ 50 OR(mailAddresses.postbox:\” \“)^ 6)”}},“sort”:[{“_ score”:{“order”:“desc”}}},{“statusIndicator”:{“order“:” asc“}}],” aggs“:{” NAME“:{” filter“:{” term“:{” NAME“:” ATLS“}}}}}
点击数:
“总计”:106421,
“max_score”:null,
“点击数”:[
{
“_shard”:0,
“_node”:“1”,
“_index”:“allocation_e1”,
“_type”:“my_type”,
“_id”:“239958846_826_E1”,
“_score”:2.9571724,
“_routing”:“E1”,
“_资源”: {
“sample_number”:239958846,
“国家/地区代码”:101,
“state”:“E1”,
“名称”:“AMERICA Plc的银行”,
运行相同查询时,文档顺序会有所不同为什么运行相同查询时文档顺序会更改?
请提前对此提供帮助
最佳答案
基于UID以降序运行查询,您将获得相同的结果。
比较以下示例。
未分类:
升序排列:
关于search - 搜索结果顺序在Elasticsearch中每次都不同,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40220516/