# Exact match not working with fields having space

**URL:** <https://discuss.elastic.co/t/exact-match-not-working-with-fields-having-space/137398>\
**Category:** Elasticsearch\
**Created:** [June 26, 2018, 9:00am UTC](https://discuss.elastic.co/t/exact-match-not-working-with-fields-having-space/137398 "2018-06-26T09:00:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vishnu\_P\_S](https://avatars.discourse-cdn.com/v4/letter/v/5f9b8f/32.png) [@Vishnu\_P\_S](https://discuss.elastic.co/u/Vishnu_P_S)\
**Post date:** [June 26, 2018, 9:00am UTC](https://discuss.elastic.co/t/exact-match-not-working-with-fields-having-space/137398/1 "2018-06-26T09:00:27Z")

</div>

I have a set of data loaded in elasticsearch. I ran the below query.  
GET /xxxxxxx/\_search  
{  
"query": {  
"bool": {  
"filter":[{"term":{"title": "Product order details" }}]}}  
}

And it returns

{  
"took": 0,  
"timed\_out": false,  
"\_shards": {  
"total": 5,  
"successful": 5,  
"skipped": 0,  
"failed": 0  
},  
"hits": {  
"total": 0,  
"max\_score": null,  
"hits": []  
}  
}

But in elastic search there is an exact match for field "title" is present. Can someone help me on this.

---

<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:** [June 26, 2018, 9:25am UTC](https://discuss.elastic.co/t/exact-match-not-working-with-fields-having-space/137398/2 "2018-06-26T09:25:02Z")

</div>

Depends on analyzer used.  
If you are using the default mapping, try the same query against `title.keyword` instead.

---

<div class="post-metadata">

**Author:** ![Vishnu\_P\_S](https://avatars.discourse-cdn.com/v4/letter/v/5f9b8f/32.png) [@Vishnu\_P\_S](https://discuss.elastic.co/u/Vishnu_P_S)\
**Post date:** [June 26, 2018, 9:35am UTC](https://discuss.elastic.co/t/exact-match-not-working-with-fields-having-space/137398/3 "2018-06-26T09:35:41Z")

</div>

This one worked, 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:** [July 24, 2018, 9:35am UTC](https://discuss.elastic.co/t/exact-match-not-working-with-fields-having-space/137398/4 "2018-07-24T09:35:42Z")

</div>

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