# How to use mutli\_match with same value

**URL:** <https://discuss.elastic.co/t/how-to-use-mutli-match-with-same-value/325882>\
**Category:** Elasticsearch\
**Created:** [February 18, 2023, 9:42am UTC](https://discuss.elastic.co/t/how-to-use-mutli-match-with-same-value/325882 "2023-02-18T09:42:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anhhungxdieu](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anhhungxdieu](https://discuss.elastic.co/u/anhhungxdieu)\
**Post date:** [February 18, 2023, 9:42am UTC](https://discuss.elastic.co/t/how-to-use-mutli-match-with-same-value/325882/1 "2023-02-18T09:42:45Z")

</div>

I'm using elastic ver7.17  
My sample documents :  
{  
"title" : "Firmly stepping forward under the glorious banner of the Party",  
"intro": "In celebration of the Party’s founding anniversary and the new spring, we proudly and firmly step forward under the glorious banner of the Party, promote the obtained achievements, strongly arouse the will and creativity of the whole people, continue to achieve greater victories in many fields, advance rapidly on the path of renewal and development, for the goal of building a society of wealthy people, a strong country, democracy, justice, and civilisation."  
}  
{  
"title" : "Proud of the glorious Party",  
"intro": "In the bustling atmosphere of the new year, the entire Party, people, and army celebrate the 93rd anniversary of the founding of the Communist Party of Vietnam - the Party of the working class, the working people, and the entire nation. With pride in the glorious Party, which has led our people to overcome all difficulties and hardships to move forward on the path of independence, freedom and development, we pledge to trust, protect and build the pure and comprehensively strong Party."  
}

And my query  
"query" : {  
"multi\_match" : {  
"query" : "glorious banner",  
"type" : "phrase",  
"fields" : {"title","intro"},  
"operator" : "and"  
}  
}

I want get my result the documents have both (title, introtext) contains exact string "glorious banner". Please help me!  
Thanks!

---

<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:** [February 18, 2023, 2:22pm UTC](https://discuss.elastic.co/t/how-to-use-mutli-match-with-same-value/325882/2 "2023-02-18T14:22:01Z")

</div>

Hi @anhhungxdieu

I believe the fields field should be like below:

```auto
"fields": [
        "title",
        "intro"
      ]

```

Doc [Multi Match Query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html).

---

<div class="post-metadata">

**Author:** ![anhhungxdieu](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anhhungxdieu](https://discuss.elastic.co/u/anhhungxdieu)\
**Post date:** [February 18, 2023, 4:04pm UTC](https://discuss.elastic.co/t/how-to-use-mutli-match-with-same-value/325882/3 "2023-02-18T16:04:58Z")

</div>

wow, it's my mistake  
however, i have a question. I'm using php client of elasticsearch, my params like  
$params = [  
'index' =\> 'items',  
'body' =\> [  
"query" =\> [  
"multi\_match" =\> [  
"query" =\> "glorious banner",  
"type" =\> "phrase\_prefix",  
"fields" =\> ["title","intro"],  
"operator" =\> "and"  
]  
]  
]  
];  
so, results return unexpected, i don't know why?  
Can you help me?  
Sorry for my english

---

<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:** [February 18, 2023, 6:00pm UTC](https://discuss.elastic.co/t/how-to-use-mutli-match-with-same-value/325882/4 "2023-02-18T18:00:48Z")

</div>

what result do you expect?  
you use the and operator, so the search term must exist in the fields that you defined in "Fields".

---

<div class="post-metadata">

**Author:** ![anhhungxdieu](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anhhungxdieu](https://discuss.elastic.co/u/anhhungxdieu)\
**Post date:** [February 19, 2023, 2:49am UTC](https://discuss.elastic.co/t/how-to-use-mutli-match-with-same-value/325882/5 "2023-02-19T02:49:35Z")

</div>

I want result return documents contains exact glourious banner  
I use combined bool with match\_phrase two fields and return my result expect  
Thank you!

---

<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:** [March 19, 2023, 2:49am UTC](https://discuss.elastic.co/t/how-to-use-mutli-match-with-same-value/325882/6 "2023-03-19T02:49:37Z")

</div>

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