# Regarding the ranking of the inspection results of elasticsearch

**URL:** <https://discuss.elastic.co/t/regarding-the-ranking-of-the-inspection-results-of-elasticsearch/337424>\
**Category:** Elasticsearch\
**Created:** [July 3, 2023, 7:43am UTC](https://discuss.elastic.co/t/regarding-the-ranking-of-the-inspection-results-of-elasticsearch/337424 "2023-07-03T07:43:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kimjinyoung](https://avatars.discourse-cdn.com/v4/letter/k/b77776/32.png) [@kimjinyoung](https://discuss.elastic.co/u/kimjinyoung)\
**Post date:** [July 3, 2023, 7:43am UTC](https://discuss.elastic.co/t/regarding-the-ranking-of-the-inspection-results-of-elasticsearch/337424/1 "2023-07-03T07:43:57Z")

</div>

hi!  
I would like to ask you about Elasticsearch's test result ranking.  
"If there is ""kimchy"" in the data below."

```auto
user.id
kimchy_00
kimchy_01
kimchy_02
..
kimchy_50

```

example of elasticsearch below

```auto
GET /_search
{
  "from": 5, 
  "size": 20, 
  "query": {
    "match": {
      "user.id": "kimchy" 
    }
  }
}

```

> **[Paginate search results | Elasticsearch Guide \[7.16\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.16/paginate-search-results.html)**

１．Will the result be determined by the order of json data?  
２．What will be the result? Please tell me the reason.  
３．What would be the result if there was a "\_score"?

---

<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:** [July 3, 2023, 11:39am UTC](https://discuss.elastic.co/t/regarding-the-ranking-of-the-inspection-results-of-elasticsearch/337424/2 "2023-07-03T11:39:25Z")

</div>

Hi @kimjinyoung

> [@kimjinyoung](#):
>
> １．Will the result be determined by the order of json data?

The order will be defined by the document's score if you don't define any ordering.

[Documentation:](https://www.elastic.co/guide/en/elasticsearch/reference/current/sort-search-results.html#_sort_order):

> The order defaults to `desc` when sorting on the `_score`, and defaults to `asc` when sorting on anything else.

> [@kimjinyoung](#):
>
> What will be the result? Please tell me the reason.

It will be empty. There is no match for the token "kimchy".  
You can try to use the [wildcard query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html) or create a analyzer that separates the text from the number and makes the match query only in the field that stores the name.

> [@kimjinyoung](#):
>
> ３．What would be the result if there was a "\_score"?

I don't know if I understood the question well, but by default the order will be by the \_score value.

---

<div class="post-metadata">

**Author:** ![kimjinyoung](https://avatars.discourse-cdn.com/v4/letter/k/b77776/32.png) [@kimjinyoung](https://discuss.elastic.co/u/kimjinyoung)\
**Post date:** [July 4, 2023, 2:30am UTC](https://discuss.elastic.co/t/regarding-the-ranking-of-the-inspection-results-of-elasticsearch/337424/4 "2023-07-04T02:30:39Z")

</div>

@RabBit_BR  
thank for comment

> @RabBit_BR  
> It will be empty. There is no match for the token "kimchy".  
> You can try to use the [wildcard query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html) or create a analyzer that separates the text from the number and makes the match query only in the field that stores the name.

Do you mean it will be empty if I do the following?

```auto
GET /_search
{
  "from": 5, 
  "size": 20, 
  "query": {
    "match": {
      "user.id": "kimchy" 
    }
  }
}

```

1. Please tell me why it is empty. Could you tell me in detail?
2. How does "wildcard" calculate the ranking?
3. If \_score is used for wildcard, how does \_score determine the ranking by?"For example, if you specify a wildcard search as "k\*y""

---

<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:** [July 5, 2023, 11:32am UTC](https://discuss.elastic.co/t/regarding-the-ranking-of-the-inspection-results-of-elasticsearch/337424/5 "2023-07-05T11:32:31Z")

</div>

> [@kimjinyoung](#):
>
> Please tell me why it is empty. Could you tell me in detail?

When the doc is indexed as "kimchy\_00", by default the standard analyzer will be applied, in this case you would have a token like this: "kimchy\_00".  
When you search for "kimchy", your token will be "kimchy". If you use the match query, you will not have results because the tokens are not the same.  
If you use a prefix query, you will get the doc because "kimchy" is present in the prefix of the token and if you use the wildcard, like `kim*y*`, you can also get results.

However, be aware of the performance of these queries and check the documentation.

Have you already performed a test to understand how the match works?

> [@kimjinyoung](#):
>
> How does "wildcard" calculate the ranking?

Well, I know that [BM25](https://opensourceconnections.com/blog/2015/10/16/bm25-the-next-generation-of-lucene-relevation/) is used to define how docs are scored. This [link](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-similarity.html) has some Elastic options.  
For details I believe the Elastic team can answer better than I can.

---

<div class="post-metadata">

**Author:** ![kimjinyoung](https://avatars.discourse-cdn.com/v4/letter/k/b77776/32.png) [@kimjinyoung](https://discuss.elastic.co/u/kimjinyoung)\
**Post date:** [July 6, 2023, 11:52pm UTC](https://discuss.elastic.co/t/regarding-the-ranking-of-the-inspection-results-of-elasticsearch/337424/6 "2023-07-06T23:52:02Z")

</div>

@RabBit_BR  
I don't understand yet, but thank you for telling me in detail.

---

<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:** [August 3, 2023, 11:52pm UTC](https://discuss.elastic.co/t/regarding-the-ranking-of-the-inspection-results-of-elasticsearch/337424/7 "2023-08-03T23:52:53Z")

</div>

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