# Problem with should boolean search request

**URL:** <https://discuss.elastic.co/t/problem-with-should-boolean-search-request/9561>\
**Category:** Elasticsearch\
**Created:** [November 5, 2012, 3:54pm UTC](https://discuss.elastic.co/t/problem-with-should-boolean-search-request/9561 "2012-11-05T15:54:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![smhdiu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smhdiu/32/1808_2.png) [@smhdiu](https://discuss.elastic.co/u/smhdiu)\
**Post date:** [November 5, 2012, 3:54pm UTC](https://discuss.elastic.co/t/problem-with-should-boolean-search-request/9561/1 "2012-11-05T15:54:28Z")

</div>

hello all

i am searching using the following string

curl -XGET [http://localhost:9200/contactsearch/\_search?pretty=truee](http://localhost:9200/contactsearch/_search?pretty=truee) -d '{  
"query" :  
{  
"bool" : {  
"should" : [ {  
"term" : {  
"email" : "smhdiu@gmail.com"  
}  
}, {  
"term" : {  
"firstName" : "Mohsin"  
}  
}, {  
"term" : {  
"lastName" : "Husen"  
}  
} ]  
}  
}}'

but i am not getting any result in searchresponce where as i have following  
record in index

{"id":8891179303112017,"journalId":10155,  
"title":"Dr","firstName":"Mohsin","initials":null,  
"lastName":"Husen","status":null,"email":"smhdiu@gmail.com" }

please suggest

any help will be greatly appreciated.

Mohsin H

--

---

<div class="post-metadata">

**Author:** ![Tanguy1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tanguy1/32/1749_2.png) [@Tanguy1](https://discuss.elastic.co/u/Tanguy1)\
**Post date:** [November 5, 2012, 4:17pm UTC](https://discuss.elastic.co/t/problem-with-should-boolean-search-request/9561/2 "2012-11-05T16:17:26Z")

</div>

If no mappings are defined, elasticsearch wil use a standard analyzer when  
indexing/searching the documents.

The string fields of your document go through an analysis process,  
and "Mohsin" becomes "mohsin", "Husen" =\> "husen", "[smh...@gmail.com](mailto:smh...@gmail.com)" =\>  
"smh.. [gmail.com](http://gmail.com)"

To learn more on analysis:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

If you want to find your document, the simpliest way if to use  
a query\_string query, which will analyze your search keywords:  
[http://localhost:9200/contactsearch/\_search?q=Husen](http://localhost:9200/contactsearch/_search?q=Husen)

If you wan to keep your boolean query, you can use query\_string or field  
queries instead of term queries:  
{  
"query": {  
"bool": {  
"should": [  
{  
"term": {  
"email": "[smh...@gmail.com](mailto:smh...@gmail.com)"  
}  
},  
{  
"field": {  
"firstName": "Mohsin"  
}  
},  
{  
"field": {  
"lastName": "Husen"  
}  
}  
]  
}  
}  
}

Since you are searching for email addresses, you should definitely use a  
specific mapping for your document type and look at UAX Url Email Tokenizer

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

-- Tanguy

Le lundi 5 novembre 2012 16:54:28 UTC+1, mohsin husen a écrit :

> hello all
> 
> i am searching using the following string
> 
> curl -XGET [http://localhost:9200/contactsearch/\_search?pretty=truee](http://localhost:9200/contactsearch/_search?pretty=truee) -d '{  
> "query" :  
> {  
> "bool" : {  
> "should" : [ {  
> "term" : {  
> "email" : "[smh...@gmail.com](mailto:smh...@gmail.com) \<javascript:\>"  
> }  
> }, {  
> "term" : {  
> "firstName" : "Mohsin"  
> }  
> }, {  
> "term" : {  
> "lastName" : "Husen"  
> }  
> } ]  
> }  
> }}'
> 
> but i am not getting any result in searchresponce where as i have  
> following record in index
> 
> {"id":8891179303112017,"journalId":10155,  
> "title":"Dr","firstName":"Mohsin","initials":null,  
> "[lastName":"Husen","status":null,"email":"smh...@gmail.com](mailto:lastName%22:%22Husen%22,%22status%22:null,%22email%22:%22smh...@gmail.com) \<javascript:\>"  
> }
> 
> please suggest
> 
> any help will be greatly appreciated.
> 
> Mohsin H

--

---

<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 6, 2017, 3:06am UTC](https://discuss.elastic.co/t/problem-with-should-boolean-search-request/9561/3 "2017-07-06T03:06:10Z")

</div>


