Some help understanding results


(Sky Stebnicki) #1

Hi all, I am continuing to test ElasticSearch for use with one of our
applications and generally love what I see.

I ran into some interesting results that I'm struggling to understand.
If anyone could show me where I've made a mistake please let me know:

I have indexed 1 type : customer { owner_id=-1, id:3062,
f_deleted:false } (there any many other fields but these are what we
are querying

Anyway, if I run this:

curl -XGET http://localhost:9200/test/customer/_search?q=owner_id:"-1"+f_deleted:false

I get 1 result as expected. However if I run:

curl -XGET http://localhost:9200/ant_demo/customer/_search -d '
{ "query":{"filtered":{"query":{"query_string":{"query":"owner_id:
"-1""}},"constant_score":{"filter":{"term":
{"f_deleted":"false"}}}}}}}
'

I get 0 results. To me these should be the exact same query. What am I
missing?

Thanks so much!

Sky


(Clinton Gormley) #2

curl -XGET http://localhost:9200/ant_demo/customer/_search -d '
{ "query":{"filtered":{"query":{"query_string":{"query":"owner_id:
"-1""}},"constant_score":{"filter":{"term":
{"f_deleted":"false"}}}}}}}
'

What happens if you try {"f_deleted": false } instead of
{"f_deleted":"false"} ?

Not sure if that is the issue, but worth a try

clint


(Sky Stebnicki) #3

I got "f_deleted":false and "owner_id":-1 rather than quotes around
the -1 and got the same results: 0 with the filtered query

Sky

On Feb 12, 4:15 am, Clinton Gormley clin...@iannounce.co.uk wrote:

curl -XGEThttp://localhost:9200/ant_demo/customer/_search-d '
{ "query":{"filtered":{"query":{"query_string":{"query":"owner_id:
"-1""}},"constant_score":{"filter":{"term":
{"f_deleted":"false"}}}}}}}
'

What happens if you try {"f_deleted": false } instead of
{"f_deleted":"false"} ?

Not sure if that is the issue, but worth a try

clint


(Shay Banon) #4

I think your query is malformed. Can you gist a simple curl recreation that index a simple doc, refresh the index, and then execute the query that works, and the one that doesn't? We can then easily run it locally and fix the query if needed.
On Saturday, February 12, 2011 at 5:18 PM, SkyStebnicki wrote:

I got "f_deleted":false and "owner_id":-1 rather than quotes around
the -1 and got the same results: 0 with the filtered query

Sky

On Feb 12, 4:15 am, Clinton Gormley clin...@iannounce.co.uk wrote:

curl -XGEThttp://localhost:9200/ant_demo/customer/_search-d '
{ "query":{"filtered":{"query":{"query_string":{"query":"owner_id:
"-1""}},"constant_score":{"filter":{"term":
{"f_deleted":"false"}}}}}}}
'

What happens if you try {"f_deleted": false } instead of
{"f_deleted":"false"} ?

Not sure if that is the issue, but worth a try

clint


(Sky Stebnicki) #5

Sure, no problem. One quick question, I've never used gist before for
anything other than viewing source. Where should I go to do that.
Sorry for the trouble.

Sky

On Feb 12, 7:32 am, Shay Banon shay.ba...@elasticsearch.com wrote:

I think your query is malformed. Can you gist a simple curl recreation that index a simple doc, refresh the index, and then execute the query that works, and the one that doesn't? We can then easily run it locally and fix the query if needed.

On Saturday, February 12, 2011 at 5:18 PM, SkyStebnicki wrote:

I got "f_deleted":false and "owner_id":-1 rather than quotes around
the -1 and got the same results: 0 with the filtered query

Sky

On Feb 12, 4:15 am, Clinton Gormley clin...@iannounce.co.uk wrote:

curl -XGEThttp://localhost:9200/ant_demo/customer/_search-d'
{ "query":{"filtered":{"query":{"query_string":{"query":"owner_id:
"-1""}},"constant_score":{"filter":{"term":
{"f_deleted":"false"}}}}}}}
'

What happens if you try {"f_deleted": false } instead of
{"f_deleted":"false"} ?

Not sure if that is the issue, but worth a try

clint


(danoyoung) #6

https://gist.github.com/

Here's some additional pointers/info:

http://www.elasticsearch.org/help/

Regards,

Dan

On Sun, Feb 13, 2011 at 8:23 AM, SkyStebnicki sky.stebnicki@gmail.comwrote:

Sure, no problem. One quick question, I've never used gist before for
anything other than viewing source. Where should I go to do that.
Sorry for the trouble.

Sky

On Feb 12, 7:32 am, Shay Banon shay.ba...@elasticsearch.com wrote:

I think your query is malformed. Can you gist a simple curl recreation
that index a simple doc, refresh the index, and then execute the query that
works, and the one that doesn't? We can then easily run it locally and fix
the query if needed.

On Saturday, February 12, 2011 at 5:18 PM, SkyStebnicki wrote:

I got "f_deleted":false and "owner_id":-1 rather than quotes around
the -1 and got the same results: 0 with the filtered query

Sky

On Feb 12, 4:15 am, Clinton Gormley clin...@iannounce.co.uk wrote:

curl -XGEThttp://localhost:9200/ant_demo/customer/_search-d'
{ "query":{"filtered":{"query":{"query_string":{"query":"owner_id:
"-1""}},"constant_score":{"filter":{"term":
{"f_deleted":"false"}}}}}}}
'

What happens if you try {"f_deleted": false } instead of
{"f_deleted":"false"} ?

Not sure if that is the issue, but worth a try

clint


(Clinton Gormley) #7

On Sun, 2011-02-13 at 07:23 -0800, SkyStebnicki wrote:

Sure, no problem. One quick question, I've never used gist before for
anything other than viewing source. Where should I go to do that.
Sorry for the trouble.

Hi Sky

Have a look at http://www.elasticsearch.org/help - it'll tell you all
you need to know about gisting a curl recreation (and if it doesn't, let
me know what is missing so that I can improve it)

thanks

clint


(system) #8