Need some help with a range query

I don;t know i only use symbol OR.

2011/11/13 electic electic@gmail.com:

I know that but is there a way to support the pipe symbol as an OR?

On Nov 13, 3:52 pm, Gustavo Maia gustavobbm...@gmail.com wrote:

User term OR.

(keyword1 OR keyword2) keyword3

2011/11/13 electic elec...@gmail.com:

Thanks Shay. You are right. It was nested wrong. I have one more
question for you guys. I have a query like this

(keyword1 | keyword2) keyword3

I am putting this into my query_string->query part of the JSON with a
default operator of AND. My guess is that the system is not
recognizing the pipe symbol for some reason. How would I use the pipe
symbol in the query?

On Nov 13, 5:34 am, Shay Banon kim...@gmail.com wrote:

No, it should be on the same level as the top most query, the search
request looks something like this:

{
"query" : { ... },
"size" : 100,
"sort" : {...}

}
On Sun, Nov 13, 2011 at 1:44 PM, electic elec...@gmail.com wrote:

Oh no, so it should be like this?

curl -XGET 192.168.8.231:9200/documents/_search -d '{
"query" : {
"filtered" : {
"query":{
"query_string" : {
"query" : "chat car",
"default_operator" : "AND"
},
"sort" : {"created_at" : "desc" }
},
"filter" : {
"and" : [{"range" : {"utimestamp" : {"gte" :
1321085190}}}]
}
},
"size" : 500
}
}'

On Nov 13, 12:52 am, Shay Banon kim...@gmail.com wrote:

Btw, your sort is not on the correct level and size are not on the
correct
level, they should be on hte same level as the outermost "query".

On Sat, Nov 12, 2011 at 8:58 PM, electic elec...@gmail.com wrote:

Thanks everyone for your help! So I have one more question. So this is
what I have now:

curl -XGET 192.168.8.231:9200/documents/_search -d '{

"query" : {
"filtered" : {
"query":{"match_all":{}},
"filter" : {
"and" : [{"term" : {"tags" : "chat car"}}, {"range" :
{"utimestamp" : {"gte" : 1321085190}}}]
},
"sort" : {"created_at" : "desc" }
},
"size" : 500
}
}'

and it works if you do it for one keyword. However, what if you want
two keywords, say, "chat car" which there are records for but it
returns nothing back. What is the best way to to do that?

On Nov 11, 8:52 pm, egaumer egau...@gmail.com wrote:

You should use a filteredQuery.

{
"filtered" : {
"query" : {
"term" : { "tags" : "ass" }
},
"filter" : {
"numeric_range" : {
"created_at" : {
"gte" : 1321050744
}
}
}
}

}

--
Gustavo Maia

--
Gustavo Maia