# Factes and result content

**URL:** <https://discuss.elastic.co/t/factes-and-result-content/14322>\
**Category:** Elasticsearch\
**Created:** [November 8, 2013, 10:07am UTC](https://discuss.elastic.co/t/factes-and-result-content/14322 "2013-11-08T10:07:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jens\_Christian\_Groh](https://avatars.discourse-cdn.com/v4/letter/j/48db29/32.png) [@Jens\_Christian\_Groh](https://discuss.elastic.co/u/Jens_Christian_Groh)\
**Post date:** [November 8, 2013, 10:07am UTC](https://discuss.elastic.co/t/factes-and-result-content/14322/1 "2013-11-08T10:07:41Z")

</div>

Hi,  
I send a post query to elasticsearch and do a facet in this query with a  
name field. In fortend I want to show the\* faceted\* name, the count but  
also an id. Name and id corresponing together each unique name has also a  
unique id.  
In the result, in the facet I only get name an count or two facets but not  
the id oft faceted name

_I send a post query to elasticsearch looks like_

{  
"fields": [  
"TestId",  
"TestName",  
"Project",  
"Id",  
"Product"  
],  
"size": 500,  
"query": {  
"bool": {  
"must": [  
{  
"field": {  
"Product": "productname"  
}  
},  
{  
"term": {  
"Project.untouched": "Muster"  
}  
},  
{  
"field": {  
"TestName": "\*"  
}  
}  
]  
}  
},  
"facets": {  
"testList": {  
"terms": {  
"field": "TestName.untouched",  
"size": 500  
}  
}  
},  
"sort": {  
"TestName": {  
"order": "asc"  
}  
}  
}

_Response looks like_

{  
"took": 5,  
"timed\_out": false,  
"\_shards": {  
"total": 5,  
"successful": 5,  
"failed": 0  
},  
"hits": {  
"total": 3,  
"max\_score": null,  
"hits": [  
{  
"\_index": "plcd\_cri\_testplanner\_left",  
"\_type": "preview",  
"\_id": "9022",  
"\_score": null,  
"fields": {  
"Project": "CRI5.1-B1-Muster",  
"Id": 9022,  
"Product": "CRI3-X",  
"TestId": 8021,  
"TestName": "VA\_0523"  
},  
"sort": [  
"va\_0523"  
]  
},  
{  
"\_index": "plcd\_cri\_testplanner\_left",  
"\_type": "preview",  
"\_id": "716",  
"\_score": null,  
"fields": {  
"Project": "CRI5.1-B1-Muster",  
"Id": 716,  
"Product": "CRI3-X",  
"TestId": 902,  
"TestName": "VA\_ZI\_001"  
},  
"sort": [  
"va\_zi\_001"  
]  
},  
{  
"\_index": "plcd\_cri\_testplanner\_left",  
"\_type": "preview",  
"\_id": "722",  
"\_score": null,  
"fields": {  
"Project": "CRI5.1-B1-Muster",  
"Id": 722,  
"Product": "CRI3-X",  
"TestId": 907,  
"TestName": "VA\_ZI\_002"  
},  
"sort": [  
"va\_zi\_002"  
]  
}  
]  
},  
"facets": {  
"testList": {  
"\_type": "terms",  
"missing": 0,  
"total": 3,  
"other": 0,  
"terms": [  
{  
"term": "VA\_ZI\_002",  
"count": 1  
},  
{  
"term": "VA\_ZI\_001",  
"count": 1  
},  
{  
"term": "VA\_0523",  
"count": 1  
}  
]  
}  
}  
}

_What i would like to have is the facetpart looks like_

"facets": {  
"testList": {  
"\_type": "terms",  
"missing": 0,  
"total": 3,  
"other": 0,  
"terms": [  
{  
"term": "VA\_ZI\_002",  
"count": 1,  
"id": 1  
},  
{  
"term": "VA\_ZI\_001",  
"count": 1,  
"id": 2  
},  
{  
"term": "VA\_0523",  
"count": 1,  
"id": 3  
}  
]  
}  
}  
}

OR

{  
"term":{ "VA\_0523",3}  
"count": 1,

```
            }

```

Is this possible?

Thanks!!  
Chris

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 8, 2013, 10:40am UTC](https://discuss.elastic.co/t/factes-and-result-content/14322/2 "2013-11-08T10:40:34Z")

</div>

No.

But may be in the future with aggregation (#3300 on github) using this:  
Aggregating Hierarchical Data

Quite often you'd like to get aggregations on location in an hierarchical manner. For example, show all countries and how many documents fall within each country, and for each country show a breakdown by city. Here's a simple way to do it using hierarchical terms aggregations:

"aggs" : { "country" : { "terms" : { "field" : "country" }, "aggs" : { "city" : { "terms" : { "field" : "city" } } } } }

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 8 nov. 2013 à 11:07, Jens Christian Groh [groh@dtis.eu](mailto:groh@dtis.eu) a écrit :

Hi,  
I send a post query to elasticsearch and do a facet in this query with a name field. In fortend I want to show the faceted name, the count but also an id. Name and id corresponing together each unique name has also a unique id.  
In the result, in the facet I only get name an count or two facets but not the id oft faceted name

I send a post query to elasticsearch looks like

{  
"fields": [  
"TestId",  
"TestName",  
"Project",  
"Id",  
"Product"  
],  
"size": 500,  
"query": {  
"bool": {  
"must": [  
{  
"field": {  
"Product": "productname"  
}  
},  
{  
"term": {  
"Project.untouched": "Muster"  
}  
},  
{  
"field": {  
"TestName": "\*"  
}  
}  
]  
}  
},  
"facets": {  
"testList": {  
"terms": {  
"field": "TestName.untouched",  
"size": 500  
}  
}  
},  
"sort": {  
"TestName": {  
"order": "asc"  
}  
}  
}

Response looks like

{  
"took": 5,  
"timed\_out": false,  
"\_shards": {  
"total": 5,  
"successful": 5,  
"failed": 0  
},  
"hits": {  
"total": 3,  
"max\_score": null,  
"hits": [  
{  
"\_index": "plcd\_cri\_testplanner\_left",  
"\_type": "preview",  
"\_id": "9022",  
"\_score": null,  
"fields": {  
"Project": "CRI5.1-B1-Muster",  
"Id": 9022,  
"Product": "CRI3-X",  
"TestId": 8021,  
"TestName": "VA\_0523"  
},  
"sort": [  
"va\_0523"  
]  
},  
{  
"\_index": "plcd\_cri\_testplanner\_left",  
"\_type": "preview",  
"\_id": "716",  
"\_score": null,  
"fields": {  
"Project": "CRI5.1-B1-Muster",  
"Id": 716,  
"Product": "CRI3-X",  
"TestId": 902,  
"TestName": "VA\_ZI\_001"  
},  
"sort": [  
"va\_zi\_001"  
]  
},  
{  
"\_index": "plcd\_cri\_testplanner\_left",  
"\_type": "preview",  
"\_id": "722",  
"\_score": null,  
"fields": {  
"Project": "CRI5.1-B1-Muster",  
"Id": 722,  
"Product": "CRI3-X",  
"TestId": 907,  
"TestName": "VA\_ZI\_002"  
},  
"sort": [  
"va\_zi\_002"  
]  
}  
]  
},  
"facets": {  
"testList": {  
"\_type": "terms",  
"missing": 0,  
"total": 3,  
"other": 0,  
"terms": [  
{  
"term": "VA\_ZI\_002",  
"count": 1  
},  
{  
"term": "VA\_ZI\_001",  
"count": 1  
},  
{  
"term": "VA\_0523",  
"count": 1  
}  
]  
}  
}  
}

What i would like to have is the facetpart looks like

"facets": {  
"testList": {  
"\_type": "terms",  
"missing": 0,  
"total": 3,  
"other": 0,  
"terms": [  
{  
"term": "VA\_ZI\_002",  
"count": 1,  
"id": 1  
},  
{  
"term": "VA\_ZI\_001",  
"count": 1,  
"id": 2  
},  
{  
"term": "VA\_0523",  
"count": 1,  
"id": 3  
}  
]  
}  
}  
}

OR

{  
"term":{ "VA\_0523",3}  
"count": 1,

```
            }

```

Is this possible?

Thanks!!  
Chris

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:08am UTC](https://discuss.elastic.co/t/factes-and-result-content/14322/3 "2017-07-06T02:08:10Z")

</div>


