Issue Related facet Query


(Sumit Guptaa) #1

Hi all,

suppose i m creating one index like

curl -XPUT 'http://localhost:9200/only/onlytype/1' -d '{
"user" : "hi hello how hi hello how when",
"post_date" : "2011-09-20T16:20:00",
"message" : "abc xyz def abc xyz ghi abc xyz ghi"
}'

and performing one facet query like.................

curl -X POST 'localhost:9200/only/onlytype/_search?pretty=true' -d '{
"query": {
"term": {
"message": "abc"
}
},
"facets": {
"message": {
"terms": {
"field": "message"
}
}
}
}'

and i m getting the result like...........

{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.16608895,
"hits" : [ {
"_index" : "only",
"_type" : "onlytype",
"_id" : "1",
"_score" : 0.16608895, "_source" : {
"user" : "hi hello how hi hello how when",
"post_date" : "2011-09-20T16:20:00",
"message" : "abc xyz def abc xyz ghi abc xyz ghi"
}
} ]
},
"facets" : {
"message" : {
"_type" : "terms",
"missing" : 0,
"total" : 4,
"other" : 0,
"terms" : [ {
"term" : "xyz",
"count" : 1
}, {
"term" : "ghi",
"count" : 1
}, {
"term" : "def",
"count" : 1
}, {
"term" : "abc",
"count" : 1
} ]
}
}
}

my question is this when i m searching for the term "abc" then i find all the duplicate "abc" count also and all the term count also...

"terms" : [ {
"term" : "xyz",
"count" : 3
}, {
"term" : "ghi",
"count" : 2
}, {
"term" : "def",
"count" : 1
}, {
"term" : "abc",
"count" : 3
} ]
}
}
}

is it possible with elasticsearch?
please help me..

Regards
Sumit gupta


(system) #2