# Why is my query not returning all elements in ES db

**URL:** <https://discuss.elastic.co/t/why-is-my-query-not-returning-all-elements-in-es-db/51177>\
**Category:** Elasticsearch\
**Created:** [May 27, 2016, 4:27pm UTC](https://discuss.elastic.co/t/why-is-my-query-not-returning-all-elements-in-es-db/51177 "2016-05-27T16:27:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![afr5798923](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@afr5798923](https://discuss.elastic.co/u/afr5798923)\
**Post date:** [May 27, 2016, 4:27pm UTC](https://discuss.elastic.co/t/why-is-my-query-not-returning-all-elements-in-es-db/51177/1 "2016-05-27T16:27:24Z")

</div>

My Settings/Mapping files  
PUT loalhost:9200/persondb  
{  
"settings": {  
"analysis": {  
"filter": {  
"autocomplete\_filter": {  
"type": "edge\_ngram",  
"min\_gram": 2,  
"max\_gram": 15  
}  
},  
"analyzer": {  
"autocomplete": {  
"type": "custom",  
"tokenizer": "whitespace",  
"filter": [  
"lowercase",  
"autocomplete\_filter"  
]  
},  
"rock\_field":{  
"type": "custom",  
"tokenizer": "whitespace",  
"filter": "lowercase"  
}  
}  
}  
}  
}  
PUT localhost:9200/persondb/userData/\_mapping  
{  
"userData": {  
"properties": {  
"FirstName": {  
"type": "string",  
"index\_analyzer": "autocomplete",  
"search\_analyzer": "rock\_field"  
},  
"LastName": {  
"type": "string",  
"index\_analyzer": "autocomplete",  
"search\_analyzer": "rock\_field"  
},  
"CurrentCompany": {  
"type": "string",  
"analyzer": "rock\_field"  
},  
"CurrentLocation": {  
"properties": {  
"City": {  
"type": "string",  
"analyzer": "rock\_field"  
},  
"Country": {  
"type": "string",  
"analyzer": "rock\_field"  
},  
"State": {  
"type": "string",  
"analyzer": "rock\_field"  
}  
}  
},  
"ProfileTitle": {  
"type": "string",  
"analyzer": "rock\_field"  
}  
}  
}  
}

[http://localhost:9200/user/search](http://localhost:9200/user/search) passing this query string = {"q":"san"}  
When I run this query from POSTMAN am getting this results with only 2 elements, and I need all the elements returned.

[  
{  
"Id": "57236cbe80eed110c8b739f5",  
"Score": 0.7097881  
},  
{  
"Id": "5739d95d80eed7100c32a59d",  
"Score": 0.48913243  
},  
{  
"Id": "57332dec80eed60a0492b68e",  
"Score": 0.3120335  
},  
..  
.....

]

thanks. any help will be appreciated.

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [May 30, 2016, 2:06pm UTC](https://discuss.elastic.co/t/why-is-my-query-not-returning-all-elements-in-es-db/51177/2 "2016-05-30T14:06:38Z")

</div>

Can you give an example of a document that should match but does not?

---

<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, 10:47pm UTC](https://discuss.elastic.co/t/why-is-my-query-not-returning-all-elements-in-es-db/51177/3 "2017-07-05T22:47:59Z")

</div>

Closed on July 5, 2017, 10:47pm UTC


