# Simple query "match" relevance

**URL:** <https://discuss.elastic.co/t/simple-query-match-relevance/311655>\
**Category:** Elasticsearch\
**Created:** [August 8, 2022, 3:17pm UTC](https://discuss.elastic.co/t/simple-query-match-relevance/311655 "2022-08-08T15:17:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guillaume\_R](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guillaume_r/32/79028_2.png) [@Guillaume\_R](https://discuss.elastic.co/u/Guillaume_R)\
**Post date:** [August 8, 2022, 3:17pm UTC](https://discuss.elastic.co/t/simple-query-match-relevance/311655/1 "2022-08-08T15:17:34Z")

</div>

Hi all,  
I'm a bit surprised with the result of the query (see the code below)  
I would expect the doc 4 to be first ... but this is the 1, 2, 5,6,3,4  
If anyone can help.

Thanks a lot

````auto
DELETE shop
PUT shop
{
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0
  },
  "mappings": {
      "properties": {
        "title": {
          "type": "text"
        },
        "title_full": {
          "type": "text"
        },
        "colour": {
          "type": "keyword"
        },
        "brand": {
          "type": "text"
        },
        "size": {
          "type": "text"
        },
        "price": {
          "type": "double"
        },
        "family_id": {
          "type": "keyword"
        }
      }
  }
}

POST shop/_doc/1
{
  "title": "iPad Air 2",
  "title_full": "iPad Air 2 Silver Apple 32gb",
  "colour": "Silver",
  "brand": "Apple",
  "size": "32gb",
  "price": 399,
  "family_id": "apple-1234"
}

POST shop/_doc/2
{
  "title": "iPad Air 2",
  "title_full": "iPad Air 2 Gold Apple 32gb",
  "colour": "Gold",
  "brand": "Apple",
  "size": "32gb",
  "price": 399,
  "family_id": "apple-1234"
}

POST shop/_doc/3
{
  "title": "iPad Air 2",
  "title_full": "iPad Air 2 Space grey Apple 32gb",
  "colour": "Space Grey",
  "brand": "Apple",
  "size": "32gb",
  "price": 399,
  "family_id": "apple-1234"
}

POST shop/_doc/4
{
  "title": "iPad Air 2",
  "title_full": "iPad Air 2 Space Grey Apple cccdd",
  "colour": "Space Grey",
  "brand": "Apple",
  "size": "128gb",
  "price": 499,
  "family_id": "apple-1234"
}

POST shop/_doc/5
{
  "title": "iPad Pro",
  "title_full": "iPad Pro Space Grey Apple 128gb",
  "colour": "Space Grey",
  "brand": "Apple",
  "size": "128gb",
  "price": 899,
  "family_id": "apple-5678"
}

POST shop/_doc/6
{
  "title": "iPad Pro",
  "title_full": "iPad Pro Space Grey Apple 256gb",
  "colour": "Space Grey",
  "brand": "Apple",
  "size": "256gb",
  "price": 999,
  "family_id": "apple-5678"
}

GET shop/_search
{
  "query": {
    "match": {
      "title_full": "ipad ccc"
    }
  }
}```
````

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [August 8, 2022, 4:50pm UTC](https://discuss.elastic.co/t/simple-query-match-relevance/311655/2 "2022-08-08T16:50:46Z")

</div>

Hi @Guillaume_R

Run the analyze API to understand the generated tokens. Due to the configuration of your mapping I believe that there is no corresponding to the term ccc because the token generated for "iPad Air 2 Space Gray Apple cccdd" would be "cccdd".

```auto
GET shop/_analyze
{
  "field": "title_full",
  "text": ["iPad Air 2 Space Grey Apple cccdd"]
}

```

If you use fuzziness you may have this more relevant document 4 in the answers.

```auto
GET shop/_search
{
  "query": {
    "match": {
      "title_full": {
        "query": "ipad ccc",
        "fuzziness": 2
      }
      
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 5, 2022, 4:50pm UTC](https://discuss.elastic.co/t/simple-query-match-relevance/311655/3 "2022-09-05T16:50:54Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
