# Why i get different result when i use term and match

**URL:** <https://discuss.elastic.co/t/why-i-get-different-result-when-i-use-term-and-match/126520>\
**Category:** Elasticsearch\
**Created:** [April 3, 2018, 8:22am UTC](https://discuss.elastic.co/t/why-i-get-different-result-when-i-use-term-and-match/126520 "2018-04-03T08:22:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chenzilong444](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@chenzilong444](https://discuss.elastic.co/u/chenzilong444)\
**Post date:** [April 3, 2018, 8:22am UTC](https://discuss.elastic.co/t/why-i-get-different-result-when-i-use-term-and-match/126520/1 "2018-04-03T08:22:49Z")

</div>

GET /logstash(2018.03.31)/\_search  
{  
"query":{  
"bool":{  
"must":[  
{"match":{"MSG":"PayResult"}  
}  
],  
"must\_not": [  
{ "match": {  
"PayResult":"Leave"}}  
]  
}  
},"size":0,  
"aggs": {  
"sed\_terms": {  
"terms": {  
"field": "PayID.keyword",  
"size": 347  
},  
"aggs": {  
"min\_time": {  
"top\_hits": {  
"sort": [  
{  
"@timestamp": {  
"order": "desc"  
}  
}  
]  
, "size": 1  
}  
},  
"max\_time": {  
"max": {  
"field": "@timestamp"  
}  
}  
}  
}  
}  
}  
i need match some fields but it tell me only one match  
so i search .they tell me i need use term ,when i use term i can't get result

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 3, 2018, 8:52am UTC](https://discuss.elastic.co/t/why-i-get-different-result-when-i-use-term-and-match/126520/2 "2018-04-03T08:52:50Z")

</div>

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.  
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.

Anyway, `match` analyze the text. `term` does not.

---

<div class="post-metadata">

**Author:** ![chenzilong444](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@chenzilong444](https://discuss.elastic.co/u/chenzilong444)\
**Post date:** [April 3, 2018, 9:00am UTC](https://discuss.elastic.co/t/why-i-get-different-result-when-i-use-term-and-match/126520/3 "2018-04-03T09:00:52Z")

</div>

thank you i have found my problem

---

<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:** [May 1, 2018, 9:01am UTC](https://discuss.elastic.co/t/why-i-get-different-result-when-i-use-term-and-match/126520/4 "2018-05-01T09:01:11Z")

</div>

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