Search on json field


(Yong Wang) #1

Hi there,

I have a doc like this:

perf_metric{
in_byte : 100,
out_byte :0,
ret_cod:{
suc: "true",
mc:"0000"
}
}

my question is, how to build a query or filter to search all doc with
ret_cod.suc="true", the ret_cod is now mapped as string, is this the key
point?

I am a newbie to elastic and sorry for so many questions :slight_smile:

Alan


(Shay Banon) #2

Here is a sample of one that searches on index test with a filtered
match_all query:

curl localhost:9200/test/_search -d '{
"query" : {
"filtered" : {
"query" : {
"match_all" : {}
},
"filter" : {
"term" : {
"ret_cod.suc" : "true"
}
}
}
}
}'

On Mon, Apr 23, 2012 at 7:01 AM, Wang Yong cnwangyong@gmail.com wrote:

Hi there,

I have a doc like this:

perf_metric{
in_byte : 100,
out_byte :0,
ret_cod:{
suc: "true",
mc:"0000"
}
}

my question is, how to build a query or filter to search all doc with
ret_cod.suc="true", the ret_cod is now mapped as string, is this the key
point?

I am a newbie to elastic and sorry for so many questions :slight_smile:

Alan


(system) #3