# 【query】multi\_match question in ES 5.5.0

**URL:** <https://discuss.elastic.co/t/query-multi-match-question-in-es-5-5-0/96709>\
**Category:** Elasticsearch\
**Created:** [August 11, 2017, 6:47am UTC](https://discuss.elastic.co/t/query-multi-match-question-in-es-5-5-0/96709 "2017-08-11T06:47:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![felayman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felayman/32/20791_2.png) [@felayman](https://discuss.elastic.co/u/felayman)\
**Post date:** [August 11, 2017, 6:47am UTC](https://discuss.elastic.co/t/query-multi-match-question-in-es-5-5-0/96709/1 "2017-08-11T06:47:56Z")

</div>

When i try to use "multi\_match" in my project.  
I find a question what is not in line with my expectations.  
first,i post some data to the es cluster as follow:

```auto
POST /blogs/blog/1
{
  "title":"elasticsearch match query",
  "descrption":"elasticsearch match query"
}
POST /blogs/blog/2
{
  "title":"elasticsearch match query",
  "descrption":"i am a dog"
}
POST /blogs/blog/3
{
  "title":"i am a dog",
  "descrption":"elasticsearch match query"
}
POST /blogs/blog/4
{
  "title":"i am a dog",
  "descrption":"i am a dog"
}

```

then , i use the query as follow:

```auto
POST /blogs/blog/_search
{
  "query": {
   "multi_match": {
     "query": "elasticsearch match query",
     "fields": ["title","descrption"]
   }
  }
}

```

the result is :

```auto
{
  "took": 0,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 3,
    "max_score": 1.9646256,
    "hits": [
      {
        "_index": "blogs",
        "_type": "blog",
        "_id": "2",
        "_score": 1.9646256,
        "_source": {
          "title": "elasticsearch match query",
          "descrption": "i am a dog"
        }
      },
      {
        "_index": "blogs",
        "_type": "blog",
        "_id": "1",
        "_score": 0.7594807,
        "_source": {
          "title": "elasticsearch match query",
          "descrption": "elasticsearch match query"
        }
      },
      {
        "_index": "blogs",
        "_type": "blog",
        "_id": "3",
        "_score": 0.7594807,
        "_source": {
          "title": "i am a dog",
          "descrption": "elasticsearch match query"
        }
      }
    ]
  }
}

```

What i think is that the score of the result (the id=1) should be in the first. But why not ?

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [August 11, 2017, 7:01am UTC](https://discuss.elastic.co/t/query-multi-match-question-in-es-5-5-0/96709/2 "2017-08-11T07:01:30Z")

</div>

If you only have a handful of docs use one shard.

---

<div class="post-metadata">

**Author:** ![felayman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felayman/32/20791_2.png) [@felayman](https://discuss.elastic.co/u/felayman)\
**Post date:** [August 11, 2017, 7:04am UTC](https://discuss.elastic.co/t/query-multi-match-question-in-es-5-5-0/96709/3 "2017-08-11T07:04:03Z")

</div>

I use the default settings , each index has 5 shards....

---

<div class="post-metadata">

**Author:** ![felayman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felayman/32/20791_2.png) [@felayman](https://discuss.elastic.co/u/felayman)\
**Post date:** [August 11, 2017, 7:23am UTC](https://discuss.elastic.co/t/query-multi-match-question-in-es-5-5-0/96709/4 "2017-08-11T07:23:52Z")

</div>

When i add some docs to the index named "blogs" , and update the param "type" to "most\_fields",and it works well.  
but i think it is strange. Default,the match is not the best result.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [August 11, 2017, 8:18am UTC](https://discuss.elastic.co/t/query-multi-match-question-in-es-5-5-0/96709/5 "2017-08-11T08:18:45Z")

</div>

> [@felayman](#):
>
> I use the default settings , each index has 5 shards…

The default settings are not tuned for a handful of docs so I'd advise against this for small sets of data.

> [@felayman](#):
>
> Default,the match is not the best result.

Like shard numbers, it's hard to predict a default [match mode](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html#multi-match-types) that works in all cases. We don't know in advance if the user typed a search that has words that are part of the same field (e.g. title:global title:warming) or part of different fields (e.g. firstname:john lastname:smith).  
The other issue here is that even if we decided the current default mode was not as generally useful as a newer mode we can't just change the current default otherwise we break a lot of applications that might be reliant on the old default.

---

<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 8, 2017, 8:18am UTC](https://discuss.elastic.co/t/query-multi-match-question-in-es-5-5-0/96709/6 "2017-09-08T08:18:50Z")

</div>

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