sam wrote:
I want to search any of list(pen, pencil,ink) from index.
I MySQL database we used following query :
select * from field where type in(pen,pencil,ink);
extract what I want to implement with query_String,please help me.
You can do it a couple of ways:
type:pen type:pencil type:ink
Or shorter:
type:(pen pencil ink)
Example:
% curl -s 'localhost:9200/test/_search?q=type:(ink%20pencil)&pretty=1'
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 0.04500804,
"hits" : [ {
"_index" : "test",
"_type" : "foo",
"_id" : "2",
"_score" : 0.04500804, "_source" : {"type":"pencil"}
}, {
"_index" : "test",
"_type" : "foo",
"_id" : "3",
"_score" : 0.04500804, "_source" : {"type":"ink"}
} ]
}
-Drew