Factes and result content

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.
For more options, visit https://groups.google.com/groups/opt_out.

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 :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 8 nov. 2013 à 11:07, Jens Christian Groh 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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.