Skip to content

strange relevance #26557

@luizamboni

Description

@luizamboni
  -> POST http://localhost:9200/products/_search
  {
    "query": {
      "bool": {
        "must": [
          {
            "query_string": {
              "query": "name:(\"smartphone\"^4 +\"samsung\"^3)"
            }
          }
        ],
        "should": [
          {
            "term": {
              "first_name": {
                "value": "smartphone",
                "boost": 3
              }
            }
          }
        ],
        "must_not": []
      }
    }
  }
  <- 200
  {
    "took": 3,
    "timed_out": false,
    "_shards": {
      "total": 5,
      "successful": 5,
      "failed": 0
    },
    "hits": {
      "total": 2,
      "max_score": 4.5522094,
      "hits": [
        {
          "_index": "products",
          "_type": "ad",
          "_id": "2",
          "_score": 4.5522094,
          "_source": {
            "name": "capa para smartphone samsung xxx",
            "first_name": "capa"
          }
        },
        {
          "_index": "products",
          "_type": "ad",
          "_id": "0",
          "_score": 2.635168,
          "_source": {
            "name": "smartphone samsung galaxy",
            "first_name": "smartphone"
          }
        }
      ]
    }
  }

Why the smartphone not win this score ? no make sense for me

the mapping bellow

{
  "mappings": {
    "ad": {
      "properties": {
        "name": {
          "type":  "text" 
        },
        "first_name": {
          "type":  "keyword" 
        }
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions