Basic Query Syntax


(Katrina) #1

Hi there,

I can't seem to figure out where I've gone wrong with the query DSL.

When working against the Rest API I get results with this:

curl -XGET http://127.0.0.1:9200/myindex/mytype/_search?q=user:annie

however I get zero results back when I make the call like this:

curl -XGET http://127.0.0.1:9200/myindex/mytype/_search -d '
{
"query" : {
"term" : { "user" : "annie" }
}
}
'

=> {"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":
0,"max_score":null,"hits":[]}}

Can any of you see what I've missed here?

Cheers,
Katrina


(Katrina) #2

Ah jeez-- I had a casing issue!

My document is indexed with user 'Annie', and I was actually making
the query with the capitalized name.

curl -XGET http://127.0.0.1:9200/myindex/mytype/_search -d '
{
"query" : {
"term" : { "user" : "Annie" }
}
}

'

When I lowercase the user name, it comes back with the expected
results.

Sorry about that!


(system) #3