Queries with word+space is not working as expected

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..!!

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