Problem searching with ES

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"}}]}}},"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"}
}

--

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",
"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"}}]}}},"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"}
}

--

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",
"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"}}]}}},"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"}
}

--