搜索结果顺序每次都在Elasticsearch

时间:2016-10-24 14:04:32

标签: search elasticsearch solr

我们有200k的记录。当第一次运行搜索查询时,大小为:500我在doc-1,doc-2,doc-3中得到结果。但是,当我第二次运行相同的搜索查询时,我将订单更改为doc-2,doc-1等...为什么每次运行相同的查询时搜索结果顺序都会有所不同?

查询:{"解释":true,"尺寸":500,"查询":{" query_string":{&# 34;查询":" ((NAME:\" BANK AMERICA \")^ 50 OR(Names.Name:(BANK AMERICA))^ 30 OR(NAME_PAIR:\" BANK AMERICA \")^ 30 OR(NORMAL_NAME :(美国银行)和城市:\" \")^ 40 OR(NORMAL_NAME :(美国银行))^ 30或(样式值:\" BS \& #34;)^ 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。邮箱:\" \")^ 6)"}},"排序":[{" _score":{" order&# 34;:"降序"}},{" statusIndicator" {"为了":" ASC"}}]," AGGS" {" NAME" {"过滤器" {"术语#34; {" NAME":" ATLS& #34;}}}}}

运行上面的结果时:

"点击":{     "总计":106421,     " max_score":null,     "点击":[       {         " _shard":0,         " _node":" 1",         " _index":" allocation_e1",         " _type":" my_type",         " _id":" 217600050_826_E1",         " _score":2.9569159,         " _routing":" E1",         " _source":{           " sample_number":217600050,           " countryCode":101,           "陈述":" E1",           "姓名":"美国银行",

当破坏相同的查询时,结果是:

查询:{"解释":true,"尺寸":500,"查询":{" query_string":{&# 34;查询":" ((NAME:\" BANK AMERICA \")^ 50 OR(Names.Name:(BANK AMERICA))^ 30 OR(NAME_PAIR:\" BANK AMERICA \")^ 30 OR(NORMAL_NAME :(美国银行)和城市:\" \")^ 40 OR(NORMAL_NAME :(美国银行))^ 30或(样式值:\" BS \& #34;)^ 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。邮箱:\" \")^ 6)"}},"排序":[{" _score":{" order&# 34;:"降序"}},{" statusIndicator" {"为了":" ASC"}}]," AGGS" {" NAME" {"过滤器" {"术语#34; {" NAME":" ATLS& #34;}}}}}

点击":{     "总计":106421,     " max_score":null,     "点击":[       {         " _shard":0,         " _node":" 1",         " _index":" allocation_e1",         " _type":" my_type",         " _id":" 239958846_826_E1",         " _score":2.9571724,         " _routing":" E1",         " _source":{           " sample_number":239958846,           " countryCode":101,           "陈述":" E1",           "姓名":"美国银行",

当运行相同的查询时,文档顺序变得不同,为什么在运行相同的查询时文档顺序会发生变化?

请提前帮助此致谢

1 个答案:

答案 0 :(得分:0)

根据UID以降序运行查询,您将获得相同的结果。

比较以下示例。

未排序:

enter image description here

升序排序: enter image description here