gpt4 book ai didi

elasticsearch - Elastic Search总是返回分数为零

转载 作者:行者123 更新时间:2023-12-03 01:23:23 25 4
gpt4 key购买 nike

我运行了索引,并尝试执行一些查询以验证数据。我发现无论我发送的 flex 搜索分数的任何请求,所有结果均为零。我正在Kibana中尝试不同的组合,所有返回的文档都包含_score为零。
以下是我的要求和回复:

GET _search
{
"version": true,
"size": 500,
"sort": [
{
"_score": {
"order": "desc"
}
}
],
"_source": {
"excludes": []
},
"stored_fields": [
"*"
],
"script_fields": {},
"docvalue_fields": [],
"query": {
"bool": {
"must": [],
"filter": [
{
"match_all": {}
},
{
"match_phrase": {
"name": {
"query": "RED"
}
}
}
],
"should": [],
"must_not": []
}
},
"highlight": {
"pre_tags": [
"@kibana-highlighted-field@"
],
"post_tags": [
"@/kibana-highlighted-field@"
],
"fields": {
"*": {}
},
"fragment_size": 2147483647
}
}

响应是:
{
"took" : 126,
"timed_out" : false,
"_shards" : {
"total" : 11,
"successful" : 11,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 4,
"relation" : "eq"
},
"max_score" : 0.0,
"hits" : [
{
"_index" : "products",
"_type" : "product",
"_id" : "11",
"_version" : 3,
"_score" : 0.0,
"_source" : {
"sellercode" : "1",
"avgreviews" : 5.0,
"saleprice" : null,
"sellable" : null,
"freedelivery" : false,
"promotedprice" : null,
"listprice" : 1200.2,
"noofreviews" : 1,
"outdooruse" : false,
"warrantycode" : null,
"australiasellable" : true,
"newrelease" : null,
"sku" : "VSTALDBED386_1",
"height" : 68.0,
"shortdescription" : "Loft Sofa Bed Wood Red Medium",
"commercialuse" : true,
"customisable" : true,
"weight" : "5656.0KG",
"typeCode" : "Bed - King Single",
"colour" : "Red",
"depth" : 51.0,
"name" : "LOFT SOFA BED WOOD RED MEDIUM",
"online" : true,
"materialcode" : "Fabric",
"assemblyrequired" : null,
"category" : [ ],
"stylecode" : "Contemporary"
},
"highlight" : {
"name" : [
"LOFT SOFA BED WOOD @kibana-highlighted-field@RED@/kibana-highlighted-field@ MEDIUM"
]
}
},
{
"_index" : "products",
"_type" : "product",
"_id" : "53",
"_version" : 3,
"_score" : 0.0,
"_source" : {
"sellercode" : "1",
"avgreviews" : 5.0,
"saleprice" : null,
"sellable" : null,
"freedelivery" : true,
"promotedprice" : null,
"listprice" : 9635.0,
"noofreviews" : 1,
"outdooruse" : false,
"warrantycode" : null,
"australiasellable" : true,
"newrelease" : null,
"sku" : "VSTALDBED393_1",
"height" : 66.0,
"shortdescription" : "tolix Stool Wood Red",
"commercialuse" : false,
"customisable" : false,
"weight" : "6525.0KG",
"typeCode" : "Bar Stool",
"colour" : "Silver",
"depth" : 25.0,
"name" : "LILLI / TOLIX STOOL WOOD RED",
"online" : true,
"materialcode" : "Metal",
"assemblyrequired" : null,
"category" : [ ],
"stylecode" : "Retro"
},
"highlight" : {
"name" : [
"LILLI / TOLIX STOOL WOOD @kibana-highlighted-field@RED@/kibana-highlighted-field@"
]
}
},
{
"_index" : "products",
"_type" : "product",
"_id" : "125",
"_version" : 3,
"_score" : 0.0,
"_source" : {
"sellercode" : "1",
"avgreviews" : 3.0,
"saleprice" : null,
"sellable" : null,
"freedelivery" : true,
"promotedprice" : null,
"listprice" : 6500.0,
"noofreviews" : 1,
"outdooruse" : false,
"warrantycode" : null,
"australiasellable" : true,
"newrelease" : null,
"sku" : "VSTALDBED405_1",
"height" : 55.0,
"shortdescription" : "Ialian Design New GasLift Chanelle Queen Size Red PU Leather Wodden
Bed frame",
"commercialuse" : false,
"customisable" : false,
"weight" : "5693.0KG",
"typeCode" : "Bed - Queen",
"colour" : "red",
"depth" : 58.0,
"name" : "ITALIAN DESIGN NEW GASLIFT CHANELLE QUEEN SIZE RED PU LEATHER WOODEN BED FRAME",
"online" : true,
"materialcode" : "Timber",
"assemblyrequired" : null,
"category" : [ ],
"stylecode" : "Contemporary"
},
"highlight" : {
"name" : [
"ITALIAN DESIGN NEW GASLIFT CHANELLE QUEEN SIZE @kibana-highlighted-field@RED@/kibana-highlighted-field@ PU LEATHER WOODEN BED FRAME"
]
}
},
{
"_index" : "products",
"_type" : "product",
"_id" : "707",
"_version" : 3,
"_score" : 0.0,
"_source" : {
"sellercode" : "2",
"avgreviews" : 2.0,
"saleprice" : null,
"sellable" : null,
"freedelivery" : false,
"promotedprice" : null,
"listprice" : 6326.0,
"noofreviews" : 1,
"outdooruse" : false,
"warrantycode" : null,
"australiasellable" : true,
"newrelease" : null,
"sku" : "VSTALDBED478_2",
"height" : 36.0,
"shortdescription" : "Leaf and Vine Rug Brown Cream red",
"commercialuse" : false,
"customisable" : true,
"weight" : "6548.0KG",
"typeCode" : "Shag Rug",
"colour" : "Brown",
"depth" : 47.0,
"name" : "LEAF AND VINE RUG BROWN CREAM RED",
"online" : true,
"materialcode" : "Plastic",
"assemblyrequired" : null,
"category" : [ ],
"stylecode" : "Contemporary"
},
"highlight" : {
"name" : [
"LEAF AND VINE RUG BROWN CREAM @kibana-highlighted-field@RED@/kibana-highlighted-field@"
]
}
}
]
}

}
你能指出我正确的方向来修复这个分数吗?
谢谢。

最佳答案

Sree,您所需要做的就是在match_phrase子句中使用must而不是filter
您的查询部分应如下所示:

"query": {
"bool": {
"must": [
{
"match_phrase": {
"name": {
"query": "RED"
}
}
}
],
"filter": [
{
"match_all": {}
}
],
"should": [],
"must_not": []
}
}

输出带有1个索引文件:
{
"took" : 7,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 0.2876821,
"hits" : [
{
"_index" : "someidx",
"_type" : "_doc",
"_id" : "c37m5W4BifZmUly9Ni-X",
"_version" : 1,
"_score" : 0.2876821,
"_source" : {
"sellercode" : "1",
"avgreviews" : 5.0,
"saleprice" : null,
"sellable" : null,
"freedelivery" : false,
"promotedprice" : null,
"listprice" : 1200.2,
"noofreviews" : 1,
"outdooruse" : false,
"warrantycode" : null,
"australiasellable" : true,
"newrelease" : null,
"sku" : "VSTALDBED386_1",
"height" : 68.0,
"shortdescription" : "Loft Sofa Bed Wood Red Medium",
"commercialuse" : true,
"customisable" : true,
"weight" : "5656.0KG",
"typeCode" : "Bed - King Single",
"colour" : "Red",
"depth" : 51.0,
"name" : "LOFT SOFA BED WOOD RED MEDIUM",
"online" : true,
"materialcode" : "Fabric",
"assemblyrequired" : null,
"category" : [ ],
"stylecode" : "Contemporary"
},
"highlight" : {
"name" : [
"LOFT SOFA BED WOOD @kibana-highlighted-field@RED@/kibana-highlighted-field@ MEDIUM"
]
}
}
]
}
}

关于elasticsearch - Elastic Search总是返回分数为零,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59235616/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com