Elastic Search gibt die Punktzahl immer als Null zurück

sree

Ich habe den Index ausgeführt und versuche, einige Abfragen auszuführen, um die Daten zu validieren. Ich habe festgestellt, dass die Bewertung der elastischen Suche für alle Ergebnisse bei jeder Anfrage, die ich gesendet habe, null ist. Ich versuche verschiedene Kombinationen in Kibana und alle zurückgegebenen Dokumente enthalten _score als Null. Nachfolgend meine Bitte und Antwort:

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

Antwort ist:

{
  "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@"
      ]
    }
  }
]
 }

} Können Sie mir die richtige Richtung zeigen, um diesen Score-Wert zu beheben. Vielen Dank.

baitmbarek

Sree, alles, was Sie brauchen, ist match_phrasein der mustKlausel anstelle von zu verwendenfilter

Ihr Abfrageteil sollte wie folgt aussehen:

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

Ausgabe mit 1 indizierten Dokument :

{
  "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"
          ]
        }
      }
    ]
  }
}

Dieser Artikel stammt aus dem Internet. Bitte geben Sie beim Nachdruck die Quelle an.

Bei Verstößen wenden Sie sich bitte [email protected] Löschen.

bearbeiten am
0

Lass mich ein paar Worte sagen

0Kommentare
LoginNach der Teilnahme an der Überprüfung

Verwandte Artikel

TOP Liste

heißlabel

Archiv