# Problem searching with ES

**URL:** <https://discuss.elastic.co/t/problem-searching-with-es/9606>\
**Category:** Elasticsearch\
**Created:** [November 7, 2012, 6:43pm UTC](https://discuss.elastic.co/t/problem-searching-with-es/9606 "2012-11-07T18:43:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyle\_Lahnakoski\_2](https://avatars.discourse-cdn.com/v4/letter/k/3e96dc/32.png) [@Kyle\_Lahnakoski\_2](https://discuss.elastic.co/u/Kyle_Lahnakoski_2)\
**Post date:** [November 7, 2012, 6:43pm UTC](https://discuss.elastic.co/t/problem-searching-with-es/9606/1 "2012-11-07T18:43:35Z")

</div>

I inserted some review queues into an ES index. I know I was successful  
because I can query them out:

QUERY  
{"query":{"match\_all":{}},"from":0,"size":10,"sort":[]}

RESULT

{  
"took": 17,  
"timed\_out": false,  
"\_shards": {  
"total": 5,  
"successful": 5,  
"failed": 0  
},  
"hits": {  
"total": 107837,  
"max\_score": 1,  
"hits": [  
{  
"\_index": "reviews121107\_173437",  
"\_type": "review",  
"\_id": "729817",  
"\_score": 1,  
"\_source": {  
"review\_time": "2012-04-27T17:47:36.000Z",  
"bug\_id": 739994,  
"attach\_id": "619104",  
"reviewer": "xxxxxx@mozilla.com",  
"requester": "yyyyyy@mozilla.com",  
"request\_time": "2012-04-27T17:42:09.000Z",  
"close\_record": {  
"name": "null"  
}  
}  
},

But when I ask for a specific term, I get nothing

QUERY

{"query":{"filtered":{"query":{"match\_all":{}},"filter":{"and":[{"term":{"reviewer":"  
[xxxxxx@mozilla.com](mailto:xxxxxx@mozilla.com)"}}]}}},"from":0,"size":10,"sort":[]}

RESULT

{  
"took": 4,  
"timed\_out": false,  
"\_shards": {  
"total": 5,  
"successful": 5,  
"failed": 0  
},  
"hits": {  
"total": 0,  
"max\_score": null,  
"hits": []  
}  
}

What is the incantation to get this search to work?

Here is my mapping, in case you think it is an analyzer problem:

mappings.reviews={  
"\_source":{"enabled": true},  
"\_all" : {"enabled" : false},  
"bug\_id":{"type":"integer", "store":"yes", "index":"not\_analyzed"},  
"attach\_id":{"type":"integer", "store":"yes",  
"index":"not\_analyzed"},  
"requester":{"type":"string", "store":"yes",  
"index":"not\_analyzed"},  
"reviewer":{"type":"string", "store":"yes", "index":"not\_analyzed"},  
"request\_time":{"type":"long", "store":"yes",  
"index":"not\_analyzed"},  
"review\_time":{"type":"long", "store":"yes",  
"index":"not\_analyzed"},  
"done\_reason":{"type":"string", "store":"yes",  
"index":"not\_analyzed"}  
}

--

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [November 7, 2012, 8:06pm UTC](https://discuss.elastic.co/t/problem-searching-with-es/9606/2 "2012-11-07T20:06:14Z")

</div>

I would suggest to verify that mappings were applied correctly by running

curl localhost:9200/index-name/\_mapping

In this particular case, it looks like the fields are not wrapper into  
properties element and are most likely ignored. It should be:

mappings.reviews={  
"\_source":{"enabled": true},  
"\_all" : {"enabled" : false},  
"properties":{  
"bug\_id":{"type":"integer", "store":"yes",  
"index":"not\_analyzed"},  
"attach\_id":{"type":"integer", "store":"yes",  
"index":"not\_analyzed"},  
"requester":{"type":"string", "store":"yes",  
"index":"not\_analyzed"},  
"reviewer":{"type":"string", "store":"yes",  
"index":"not\_analyzed"},  
"request\_time":{"type":"long", "store":"yes",  
"index":"not\_analyzed"},  
"review\_time":{"type":"long", "store":"yes",  
"index":"not\_analyzed"},  
"done\_reason":{"type":"string", "store":"yes",  
"index":"not\_analyzed"}  
}  
}

On Wednesday, November 7, 2012 1:43:35 PM UTC-5, Kyle Lahnakoski wrote:

> I inserted some review queues into an ES index. I know I was successful  
> because I can query them out:
> 
> QUERY  
> {"query":{"match\_all":{}},"from":0,"size":10,"sort":}
> 
> RESULT
> 
> {  
> "took": 17,  
> "timed\_out": false,  
> "\_shards": {  
> "total": 5,  
> "successful": 5,  
> "failed": 0  
> },  
> "hits": {  
> "total": 107837,  
> "max\_score": 1,  
> "hits": [  
> {  
> "\_index": "reviews121107\_173437",  
> "\_type": "review",  
> "\_id": "729817",  
> "\_score": 1,  
> "\_source": {  
> "review\_time": "2012-04-27T17:47:36.000Z",  
> "bug\_id": 739994,  
> "attach\_id": "619104",  
> "reviewer": "[xxxxxx@mozilla.com](mailto:xxxxxx@mozilla.com)",  
> "requester": "[yyyyyy@mozilla.com](mailto:yyyyyy@mozilla.com)",  
> "request\_time": "2012-04-27T17:42:09.000Z",  
> "close\_record": {  
> "name": "null"  
> }  
> }  
> },
> 
> But when I ask for a specific term, I get nothing
> 
> QUERY
> 
> {"query":{"filtered":{"query":{"match\_all":{}},"filter":{"and":[{"term":{"reviewer":"  
> [xxxxxx@mozilla.com](mailto:xxxxxx@mozilla.com)"}}]}}},"from":0,"size":10,"sort":}
> 
> RESULT
> 
> {  
> "took": 4,  
> "timed\_out": false,  
> "\_shards": {  
> "total": 5,  
> "successful": 5,  
> "failed": 0  
> },  
> "hits": {  
> "total": 0,  
> "max\_score": null,  
> "hits":   
> }  
> }
> 
> What is the incantation to get this search to work?
> 
> Here is my mapping, in case you think it is an analyzer problem:
> 
> mappings.reviews={  
> "\_source":{"enabled": true},  
> "\_all" : {"enabled" : false},  
> "bug\_id":{"type":"integer", "store":"yes", "index":"not\_analyzed"},  
> "attach\_id":{"type":"integer", "store":"yes",  
> "index":"not\_analyzed"},  
> "requester":{"type":"string", "store":"yes",  
> "index":"not\_analyzed"},  
> "reviewer":{"type":"string", "store":"yes",  
> "index":"not\_analyzed"},  
> "request\_time":{"type":"long", "store":"yes",  
> "index":"not\_analyzed"},  
> "review\_time":{"type":"long", "store":"yes",  
> "index":"not\_analyzed"},  
> "done\_reason":{"type":"string", "store":"yes",  
> "index":"not\_analyzed"}  
> }

--

---

<div class="post-metadata">

**Author:** ![Kyle\_Lahnakoski\_2](https://avatars.discourse-cdn.com/v4/letter/k/3e96dc/32.png) [@Kyle\_Lahnakoski\_2](https://discuss.elastic.co/u/Kyle_Lahnakoski_2)\
**Post date:** [November 8, 2012, 2:16am UTC](https://discuss.elastic.co/t/problem-searching-with-es/9606/3 "2012-11-08T02:16:04Z")

</div>

Thank you. That was the problem.

On Wednesday, November 7, 2012 3:06:14 PM UTC-5, Igor Motov wrote:

> I would suggest to verify that mappings were applied correctly by running
> 
> curl localhost:9200/index-name/\_mapping
> 
> In this particular case, it looks like the fields are not wrapper into  
> properties element and are most likely ignored. It should be:
> 
> mappings.reviews={  
> "\_source":{"enabled": true},  
> "\_all" : {"enabled" : false},  
> "properties":{  
> "bug\_id":{"type":"integer", "store":"yes",  
> "index":"not\_analyzed"},  
> "attach\_id":{"type":"integer", "store":"yes",  
> "index":"not\_analyzed"},  
> "requester":{"type":"string", "store":"yes",  
> "index":"not\_analyzed"},  
> "reviewer":{"type":"string", "store":"yes",  
> "index":"not\_analyzed"},  
> "request\_time":{"type":"long", "store":"yes",  
> "index":"not\_analyzed"},  
> "review\_time":{"type":"long", "store":"yes",  
> "index":"not\_analyzed"},  
> "done\_reason":{"type":"string", "store":"yes",  
> "index":"not\_analyzed"}  
> }  
> }
> 
> On Wednesday, November 7, 2012 1:43:35 PM UTC-5, Kyle Lahnakoski wrote:
> 
> > I inserted some review queues into an ES index. I know I was successful  
> > because I can query them out:
> > 
> > QUERY  
> > {"query":{"match\_all":{}},"from":0,"size":10,"sort":}
> > 
> > RESULT
> > 
> > {  
> > "took": 17,  
> > "timed\_out": false,  
> > "\_shards": {  
> > "total": 5,  
> > "successful": 5,  
> > "failed": 0  
> > },  
> > "hits": {  
> > "total": 107837,  
> > "max\_score": 1,  
> > "hits": [  
> > {  
> > "\_index": "reviews121107\_173437",  
> > "\_type": "review",  
> > "\_id": "729817",  
> > "\_score": 1,  
> > "\_source": {  
> > "review\_time": "2012-04-27T17:47:36.000Z",  
> > "bug\_id": 739994,  
> > "attach\_id": "619104",  
> > "reviewer": "[xxxxxx@mozilla.com](mailto:xxxxxx@mozilla.com)",  
> > "requester": "[yyyyyy@mozilla.com](mailto:yyyyyy@mozilla.com)",  
> > "request\_time": "2012-04-27T17:42:09.000Z",  
> > "close\_record": {  
> > "name": "null"  
> > }  
> > }  
> > },
> > 
> > But when I ask for a specific term, I get nothing
> > 
> > QUERY
> > 
> > {"query":{"filtered":{"query":{"match\_all":{}},"filter":{"and":[{"term":{"reviewer":"  
> > [xxxxxx@mozilla.com](mailto:xxxxxx@mozilla.com)"}}]}}},"from":0,"size":10,"sort":}
> > 
> > RESULT
> > 
> > {  
> > "took": 4,  
> > "timed\_out": false,  
> > "\_shards": {  
> > "total": 5,  
> > "successful": 5,  
> > "failed": 0  
> > },  
> > "hits": {  
> > "total": 0,  
> > "max\_score": null,  
> > "hits":   
> > }  
> > }
> > 
> > What is the incantation to get this search to work?
> > 
> > Here is my mapping, in case you think it is an analyzer problem:
> > 
> > mappings.reviews={  
> > "\_source":{"enabled": true},  
> > "\_all" : {"enabled" : false},  
> > "bug\_id":{"type":"integer", "store":"yes",  
> > "index":"not\_analyzed"},  
> > "attach\_id":{"type":"integer", "store":"yes",  
> > "index":"not\_analyzed"},  
> > "requester":{"type":"string", "store":"yes",  
> > "index":"not\_analyzed"},  
> > "reviewer":{"type":"string", "store":"yes",  
> > "index":"not\_analyzed"},  
> > "request\_time":{"type":"long", "store":"yes",  
> > "index":"not\_analyzed"},  
> > "review\_time":{"type":"long", "store":"yes",  
> > "index":"not\_analyzed"},  
> > "done\_reason":{"type":"string", "store":"yes",  
> > "index":"not\_analyzed"}  
> > }

--

---

<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:05am UTC](https://discuss.elastic.co/t/problem-searching-with-es/9606/4 "2017-07-06T03:05:34Z")

</div>


