Bug or feature? different results when querying using -d '{}' and ?q=

Hi,
I am noticing strange behaviour on my elastic search installation. I'm
using couchdb river and the following query:

curl -XGET http://localhost:9200/product_test/product_test/_search -d
'
{
"query": {
"term": {
"firstName": "Lorem"
}
}
}'

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

While the request:
curl -XGET http://localhost:9200/product_test/product_test/_search?q=firstName:Lorem

returns expected result:
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.13424811,
"hits" : [ {
"_index" : "product_test",
"_type" : "product_test",
"_id" : "e66fe7d98b65e41d97059538f5019644",
"_score" : 0.13424811, "_source" :
{"_rev":"1-6ace531ad6ce61f232c4b0931bb83671","call":
{"phone":"123456"},"form":{"lastName":"Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Fusce eget tellus venenatis enim interdum
malesuada at a nibh. Proin tempor pretium aliquet. Integer dui mi,
placerat ut vulputate quis, imperdiet quis arcu. Donec elementum
faucibus nunc, et ultricies nisi eleifend id. Fusce euismod felis
ullamcorper quam feugiat rutrum. Nunc ornare ultricies lectus, nec
ultrices velit viverra ut. Vivamus accumsan porta lorem, at pretium
ipsum sagittis in. Fusce sem eros, pretium non convallis id, elementum
quis nisl. Ut nisl lacus, luctus id iaculis quis, malesuada eu
arcu.","firstName":"Lorem ipsum dolor sit
amet"},"_id":"e66fe7d98b65e41d97059538f5019644","meta":
{"assigned":"johnDoe"}}
} ]
}
}

What makes it even stranger is that when I pass the search in
lowercase, it works:
{
"query": {
"term": {
"firstName": "Lorem"
}
}
}

I haven't seen much info about this in the doc. What I want, is to
perform search only in those documents, which have been assigned to
certain user (property with a certain value) and I need this to be
case sensitive...

I'm using elasticsearch 0.17.9

Thanks for pointing me to the right docs :slight_smile:

Matyas

By passing it in lowercase, i meant:

{
"query": {
"term": {
"firstName": "lorem"
}
}
}

A typo in my first post

Matyas

On 27 říj, 15:33, Matyas Rak cra...@gmail.com wrote:

Hi,
I am noticing strange behaviour on my Elasticsearch installation. I'm
using couchdb river and the following query:

curl -XGEThttp://localhost:9200/product_test/product_test/_search-d
'
{
"query": {
"term": {
"firstName": "Lorem"
}
}

}'

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

While the request:
curl -XGEThttp://localhost:9200/product_test/product_test/_search?q=firstName:L...

returns expected result:
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.13424811,
"hits" : [ {
"_index" : "product_test",
"_type" : "product_test",
"_id" : "e66fe7d98b65e41d97059538f5019644",
"_score" : 0.13424811, "_source" :
{"_rev":"1-6ace531ad6ce61f232c4b0931bb83671","call":
{"phone":"123456"},"form":{"lastName":"Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Fusce eget tellus venenatis enim interdum
malesuada at a nibh. Proin tempor pretium aliquet. Integer dui mi,
placerat ut vulputate quis, imperdiet quis arcu. Donec elementum
faucibus nunc, et ultricies nisi eleifend id. Fusce euismod felis
ullamcorper quam feugiat rutrum. Nunc ornare ultricies lectus, nec
ultrices velit viverra ut. Vivamus accumsan porta lorem, at pretium
ipsum sagittis in. Fusce sem eros, pretium non convallis id, elementum
quis nisl. Ut nisl lacus, luctus id iaculis quis, malesuada eu
arcu.","firstName":"Lorem ipsum dolor sit
amet"},"_id":"e66fe7d98b65e41d97059538f5019644","meta":
{"assigned":"johnDoe"}}
} ]
}

}

What makes it even stranger is that when I pass the search in
lowercase, it works:
{
"query": {
"term": {
"firstName": "Lorem"
}
}

}

I haven't seen much info about this in the doc. What I want, is to
perform search only in those documents, which have been assigned to
certain user (property with a certain value) and I need this to be
case sensitive...

I'm using elasticsearch 0.17.9

Thanks for pointing me to the right docs :slight_smile:

Matyas

Using q= in the URI ends up being translated to a query_string query, not a
term query. The query_string query analyzes the text you provide to search.

On Thu, Oct 27, 2011 at 3:38 PM, Matyas Rak crabcz@gmail.com wrote:

By passing it in lowercase, i meant:

{
"query": {
"term": {
"firstName": "lorem"
}
}
}

A typo in my first post

Matyas

On 27 říj, 15:33, Matyas Rak cra...@gmail.com wrote:

Hi,
I am noticing strange behaviour on my Elasticsearch installation. I'm
using couchdb river and the following query:

curl -XGEThttp://localhost:9200/product_test/product_test/_search-d
'
{
"query": {
"term": {
"firstName": "Lorem"
}
}

}'

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

While the request:
curl
-XGEThttp://localhost:9200/product_test/product_test/_search?q=firstName:L...

returns expected result:
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.13424811,
"hits" : [ {
"_index" : "product_test",
"_type" : "product_test",
"_id" : "e66fe7d98b65e41d97059538f5019644",
"_score" : 0.13424811, "_source" :
{"_rev":"1-6ace531ad6ce61f232c4b0931bb83671","call":
{"phone":"123456"},"form":{"lastName":"Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Fusce eget tellus venenatis enim interdum
malesuada at a nibh. Proin tempor pretium aliquet. Integer dui mi,
placerat ut vulputate quis, imperdiet quis arcu. Donec elementum
faucibus nunc, et ultricies nisi eleifend id. Fusce euismod felis
ullamcorper quam feugiat rutrum. Nunc ornare ultricies lectus, nec
ultrices velit viverra ut. Vivamus accumsan porta lorem, at pretium
ipsum sagittis in. Fusce sem eros, pretium non convallis id, elementum
quis nisl. Ut nisl lacus, luctus id iaculis quis, malesuada eu
arcu.","firstName":"Lorem ipsum dolor sit
amet"},"_id":"e66fe7d98b65e41d97059538f5019644","meta":
{"assigned":"johnDoe"}}
} ]
}

}

What makes it even stranger is that when I pass the search in
lowercase, it works:
{
"query": {
"term": {
"firstName": "Lorem"
}
}

}

I haven't seen much info about this in the doc. What I want, is to
perform search only in those documents, which have been assigned to
certain user (property with a certain value) and I need this to be
case sensitive...

I'm using elasticsearch 0.17.9

Thanks for pointing me to the right docs :slight_smile:

Matyas