# Difference between matchquery and matchphrase query

**URL:** <https://discuss.elastic.co/t/difference-between-matchquery-and-matchphrase-query/220873>\
**Category:** Elasticsearch\
**Created:** [February 25, 2020, 2:23pm UTC](https://discuss.elastic.co/t/difference-between-matchquery-and-matchphrase-query/220873 "2020-02-25T14:23:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![arvind73156](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@arvind73156](https://discuss.elastic.co/u/arvind73156)\
**Post date:** [February 25, 2020, 2:23pm UTC](https://discuss.elastic.co/t/difference-between-matchquery-and-matchphrase-query/220873/1 "2020-02-25T14:23:33Z")

</div>

I need to know the difference between matchquery and match phrase query if i use them to search for text "92%". Would i able to get exact match for this text using match query or match phrase query.

---

<div class="post-metadata">

**Author:** ![Magnus\_Kessler](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnus_kessler/32/42001_2.png) [@Magnus\_Kessler](https://discuss.elastic.co/u/Magnus_Kessler)\
**Post date:** [February 25, 2020, 4:49pm UTC](https://discuss.elastic.co/t/difference-between-matchquery-and-matchphrase-query/220873/2 "2020-02-25T16:49:42Z")

</div>

A `match` query looks for the existence of a token in a field, whereas a `match_phrase` query looks for the existence of a sequence of tokens (a phrase) in the field.

Both work on the results of the analysis performed during indexing and searching. The [standard analyser](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-standard-analyzer.html) will remove the percentage sign from the token, so both won't return any results.

A better approach might be to store just the numerical value (as `92`, or `0.92`) into field mapped with one of the numerical datatypes, on which aggregations or range searches can be performed.

---

<div class="post-metadata">

**Author:** ![arvind73156](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@arvind73156](https://discuss.elastic.co/u/arvind73156)\
**Post date:** [February 26, 2020, 7:34am UTC](https://discuss.elastic.co/t/difference-between-matchquery-and-matchphrase-query/220873/3 "2020-02-26T07:34:11Z")

</div>

I am using following property during mapping:  
"type", "string"  
"index", "not\_analyzed".

I have used term query,match query and match phrase query to search for value 92% but we are not able to get any response from elastic search.  
Even term query doesn't providing any value for exact match.

---

<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 25, 2020, 7:34am UTC](https://discuss.elastic.co/t/difference-between-matchquery-and-matchphrase-query/220873/4 "2020-03-25T07:34:15Z")

</div>

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