# Issue Related facet Query

**URL:** <https://discuss.elastic.co/t/issue-related-facet-query/7417>\
**Category:** Elasticsearch\
**Created:** [April 20, 2012, 9:23am UTC](https://discuss.elastic.co/t/issue-related-facet-query/7417 "2012-04-20T09:23:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sumit\_Guptaa](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@Sumit\_Guptaa](https://discuss.elastic.co/u/Sumit_Guptaa)\
**Post date:** [April 20, 2012, 9:23am UTC](https://discuss.elastic.co/t/issue-related-facet-query/7417/1 "2012-04-20T09:23:41Z")

</div>

Hi all,

suppose i m creating one index like

curl -XPUT '[http://localhost:9200/only/onlytype/1](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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:31am UTC](https://discuss.elastic.co/t/issue-related-facet-query/7417/2 "2017-07-06T03:31:40Z")

</div>

Closed on July 6, 2017, 3:31am UTC


