# Queries with word+space is not working as expected

**URL:** <https://discuss.elastic.co/t/queries-with-word-space-is-not-working-as-expected/93178>\
**Category:** Elasticsearch\
**Created:** [July 14, 2017, 11:37am UTC](https://discuss.elastic.co/t/queries-with-word-space-is-not-working-as-expected/93178 "2017-07-14T11:37:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![contact.pawan](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@contact.pawan](https://discuss.elastic.co/u/contact.pawan)\
**Post date:** [July 14, 2017, 11:37am UTC](https://discuss.elastic.co/t/queries-with-word-space-is-not-working-as-expected/93178/1 "2017-07-14T11:37:01Z")

</div>

Hi All,  
Well to begin with I am new to elasticsearch and may not have used all the possible ways

I am having documents like 'car hire','car hired','car hire for airport', 'hire car toyota', 'ca','ca test','ca test1','ca test2','test3 ca','test4 ca' etc.  
Whenever I am running a query like,  
**['query' =\> ['term' =\> ['fld\_name' =\> 'ca']]]**  
I am getting CA in return.

But, whenever I am trying to execute queries with (word+space) like:  
**['query' =\> ['term' =\> ['fld\_name' =\> 'ca ']]]** //This wont return any value as it matches of exact values  
**['query' =\> ['match' =\> ['fld\_name' =\> 'ca ']]]** //This returns values like 'car hire' and 'hire car toyota' as well..

Here I was expecting it to return ca test,ca test1,ca test2,'test3 ca','test4 ca'..

I have tried almost all the types of queries like query\_string,match,match\_phrase,match\_phrase\_prefix but have not got it to work..

My problem is not limited to single word searches, it can contain [two words+space] like,  
**['query' =\> ['match' =\> ['fld\_name' =\> 'car hire ']]]** //This should not return 'car hired'

Please help..!!

---

<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:** [August 11, 2017, 11:37am UTC](https://discuss.elastic.co/t/queries-with-word-space-is-not-working-as-expected/93178/2 "2017-08-11T11:37:02Z")

</div>

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