Query not retuning document

Hi everyone, I cannot figure out why the following search does not
work. If you could help get me pointed in the right direction on this
issue I would greatly appreciate it.

Here is the mapping (I have omitted non-related properties for
simplicity):

curl -GET http://localhost:9200/ant_demo/email_thread/_mapping?pretty=true
{
"ant_demo" : {
"id" : {
"type" : "long"
},
"owner_id" : {
"type" : "string"
}
}
}
}
}

Pulling a record by id so we know it exists:

curl -XGET http://localhost:9200/an_demo/contact_personal/3
{
"_index":"ant_demo",
"_type":"contact_personal",
"_id":"3","_version":2,
"_source" :
{
"f_deleted":"false",
"id":"3",
"user_id":"2"
}
}

Try to query based on user_id:

curl -XGET http://local_demo/contact_personal/_search?pretty=true -d '
{
"query" :
{
"query_string" :
{
"query" : "user_id:2"
}
}
}
';

The results:
{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

I also tried:

curl -XGET http://localhost:9200/ant_demo/contact_personal/_search?q=user_id:2

But got 0 hits. Why is this?

Can you generate a curl recreation with the indexing part? Check Elasticsearch Platform — Find real-time answers at scale | Elastic.
On Thursday, February 24, 2011 at 7:37 PM, SkyStebnicki wrote:

Hi everyone, I cannot figure out why the following search does not
work. If you could help get me pointed in the right direction on this
issue I would greatly appreciate it.

Here is the mapping (I have omitted non-related properties for
simplicity):

curl -GET http://localhost:9200/ant_demo/email_thread/_mapping?pretty=true
{
"ant_demo" : {
"id" : {
"type" : "long"
},
"owner_id" : {
"type" : "string"
}
}
}
}
}

Pulling a record by id so we know it exists:

curl -XGET http://localhost:9200/an_demo/contact_personal/3
{
"_index":"ant_demo",
"_type":"contact_personal",
"_id":"3","_version":2,
"_source" :
{
"f_deleted":"false",
"id":"3",
"user_id":"2"
}
}

Try to query based on user_id:

curl -XGET http://local_demo/contact_personal/_search?pretty=true -d '
{
"query" :
{
"query_string" :
{
"query" : "user_id:2"
}
}
}
';

The results:
{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
}

I also tried:

curl -XGET http://localhost:9200/ant_demo/contact_personal/_search?q=user_id:2

But got 0 hits. Why is this?

Yeah that's kind of a problem. This is a large index being created by
our web application through a PHP interface. It's difficult to
reproduce with a few simple commands in CURL because we cannot
replicate the behaviour. That's why I was hoping there was some other
way to determine why the document was not found even though it clearly
exists in the index. I can continue testing to try and figure out
exactly why this happened and how to reproduce it.

On Feb 24, 5:05 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Can you generate a curl recreation with the indexing part? Checkhttp://www.elasticsearch.org/help.

On Thursday, February 24, 2011 at 7:37 PM, SkyStebnicki wrote:

Hi everyone, I cannot figure out why the following search does not
work. If you could help get me pointed in the right direction on this
issue I would greatly appreciate it.

Here is the mapping (I have omitted non-related properties for
simplicity):

curl -GEThttp://localhost:9200/ant_demo/email_thread/_mapping?pretty=true
{
"ant_demo" : {
"id" : {
"type" : "long"
},
"owner_id" : {
"type" : "string"
}
}
}
}
}

Pulling a record by id so we know it exists:

curl -XGEThttp://localhost:9200/an_demo/contact_personal/3
{
"_index":"ant_demo",
"_type":"contact_personal",
"_id":"3","_version":2,
"_source" :
{
"f_deleted":"false",
"id":"3",
"user_id":"2"
}
}

Try to query based on user_id:

curl -XGEThttp://local_demo/contact_personal/_search?pretty=true-d '
{
"query" :
{
"query_string" :
{
"query" : "user_id:2"
}
}
}
';

The results:
{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
}

I also tried:

curl -XGEThttp://localhost:9200/ant_demo/contact_personal/_search?q=user_id:2

But got 0 hits. Why is this?

I deleted the type, then reindexed all the documents for that type
with the exact same data. The query now works? Interesting. I wonder
if it has anything to do with the types. Is there a way to turn off
the automatic schema mapping so I can force a manual map at all times?

Sky

On Feb 24, 11:51 pm, SkyStebnicki sky.stebni...@gmail.com wrote:

Yeah that's kind of a problem. This is a large index being created by
our web application through a PHP interface. It's difficult to
reproduce with a few simple commands in CURL because we cannot
replicate the behaviour. That's why I was hoping there was some other
way to determine why the document was not found even though it clearly
exists in the index. I can continue testing to try and figure out
exactly why this happened and how to reproduce it.

On Feb 24, 5:05 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Can you generate a curl recreation with the indexing part? Checkhttp://www.elasticsearch.org/help.

On Thursday, February 24, 2011 at 7:37 PM, SkyStebnicki wrote:

Hi everyone, I cannot figure out why the following search does not
work. If you could help get me pointed in the right direction on this
issue I would greatly appreciate it.

Here is the mapping (I have omitted non-related properties for
simplicity):

curl -GEThttp://localhost:9200/ant_demo/email_thread/_mapping?pretty=true
{
"ant_demo" : {
"id" : {
"type" : "long"
},
"owner_id" : {
"type" : "string"
}
}
}
}
}

Pulling a record by id so we know it exists:

curl -XGEThttp://localhost:9200/an_demo/contact_personal/3
{
"_index":"ant_demo",
"_type":"contact_personal",
"_id":"3","_version":2,
"_source" :
{
"f_deleted":"false",
"id":"3",
"user_id":"2"
}
}

Try to query based on user_id:

curl -XGEThttp://local_demo/contact_personal/_search?pretty=true-d'
{
"query" :
{
"query_string" :
{
"query" : "user_id:2"
}
}
}
';

The results:
{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
}

I also tried:

curl -XGEThttp://localhost:9200/ant_demo/contact_personal/_search?q=user_id:2

But got 0 hits. Why is this?

Yes, in 0.15, you can set in the mapping dynamic set to strict: Elasticsearch Platform — Find real-time answers at scale | Elastic.
On Friday, February 25, 2011 at 6:36 PM, SkyStebnicki wrote:

I deleted the type, then reindexed all the documents for that type
with the exact same data. The query now works? Interesting. I wonder
if it has anything to do with the types. Is there a way to turn off
the automatic schema mapping so I can force a manual map at all times?

Sky

On Feb 24, 11:51 pm, SkyStebnicki sky.stebni...@gmail.com wrote:

Yeah that's kind of a problem. This is a large index being created by
our web application through a PHP interface. It's difficult to
reproduce with a few simple commands in CURL because we cannot
replicate the behaviour. That's why I was hoping there was some other
way to determine why the document was not found even though it clearly
exists in the index. I can continue testing to try and figure out
exactly why this happened and how to reproduce it.

On Feb 24, 5:05 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Can you generate a curl recreation with the indexing part? Checkhttp://www.elasticsearch.org/help.

On Thursday, February 24, 2011 at 7:37 PM, SkyStebnicki wrote:

Hi everyone, I cannot figure out why the following search does not
work. If you could help get me pointed in the right direction on this
issue I would greatly appreciate it.

Here is the mapping (I have omitted non-related properties for
simplicity):

curl -GEThttp://localhost:9200/ant_demo/email_thread/_mapping?pretty=true
{
"ant_demo" : {
"id" : {
"type" : "long"
},
"owner_id" : {
"type" : "string"
}
}
}
}
}

Pulling a record by id so we know it exists:

curl -XGEThttp://localhost:9200/an_demo/contact_personal/3
{
"_index":"ant_demo",
"_type":"contact_personal",
"_id":"3","_version":2,
"_source" :
{
"f_deleted":"false",
"id":"3",
"user_id":"2"
}
}

Try to query based on user_id:

curl -XGEThttp://local_demo/contact_personal/_search?pretty=true-d'
{
"query" :
{
"query_string" :
{
"query" : "user_id:2"
}
}
}
';

The results:
{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
}

I also tried:

curl -XGEThttp://localhost:9200/ant_demo/contact_personal/_search?q=user_id:2

But got 0 hits. Why is this?