# Search not working for more than two words. 2 issues and 1 doubt in Elastic search

**URL:** <https://discuss.elastic.co/t/search-not-working-for-more-than-two-words-2-issues-and-1-doubt-in-elastic-search/26661>\
**Category:** Elasticsearch\
**Created:** [July 31, 2015, 7:59pm UTC](https://discuss.elastic.co/t/search-not-working-for-more-than-two-words-2-issues-and-1-doubt-in-elastic-search/26661 "2015-07-31T19:59:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![marafee1243](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marafee1243/32/3971_2.png) [@marafee1243](https://discuss.elastic.co/u/marafee1243)\
**Post date:** [July 31, 2015, 7:59pm UTC](https://discuss.elastic.co/t/search-not-working-for-more-than-two-words-2-issues-and-1-doubt-in-elastic-search/26661/1 "2015-07-31T19:59:07Z")

</div>

Recently, I migrate MySQL database to Elasticsearch.  
and its basically dump of million resumes.

Now, I am using official PHPClient API to interact with Elasticsearch.

FYI,  
below is my cluster index fields

> [name, email, state, resume\_text, visa]

I have few questions. I tried searching online resources to tweak my search.  
But could not meet with my requirement.

Below is the issues, I am head on wall to it.

## Issue 1 :

tried to search `"content management system"` with field `resume_text`  
could get the desired result, the search result is worst, sometimes cant even find "content", "management" or "system"  
few resumes.

So, with `<2` words, its returns bad result set.

Below is the syntax, i got from documentation and other resources

> $searchParams['body']['query']['bool']['must'] = array('match' =\> array('resume\_text' =\> $skill\_name));

I tried even `term`, but not good result.  
I dont know, what I did wrong.

## Issue 2 :

I need to get the resumes, with respect to location i.e. `"state".`  
I tried to search with `<1` state, it doesnt give proper results. I get other states resumes too.  
only one state works perfect.  
Alabama and Alaska, it should get me only these two results

> $searchParams['body']['query']['bool']['should']['term'] = array('cur\_state' =\> $state\_name);

## Issue 3 : [Not an issue, a doubt]

Can we search results from field to a variable.  
For example.

```
$visa_variable = "Citizen, Green Card, H1B";

```

now, how can we search relating to 3 words in variable without spliting or explode in php then  
searching independently .

Hmm. thats it. thanks

---

<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 5, 2017, 11:57pm UTC](https://discuss.elastic.co/t/search-not-working-for-more-than-two-words-2-issues-and-1-doubt-in-elastic-search/26661/2 "2017-07-05T23:57:57Z")

</div>


