Example:
{
"title" : "foo",
"author" : "bar",
"category" : {
"level1": "books",
"level2": "science",
"level3": "mathematics"
}
}
then perform nested aggregation
"aggs" : {
"level1" : {
"terms" : {
"field" : "category.level1"
},
"aggs" : {
"level2" : {
"terms": {
"field" : "category.level2"
},
"aggs" : {
"level3" : {
"terms" : {
"field" : "category.level3"
}
}
}
}
}
}
}
Jörg
On Mon, Apr 14, 2014 at 9:12 AM, Stefan <[email protected]> wrote:
> Hello,
>
> I have a mysql table with categories in a nested set structure (
> http://en.wikipedia.org/wiki/Nested_set_model).
>
> How can I map an entire category tree of an articel with an foreign key of
> the category table?
>
> That I have in MySQL and I would like to have this tree as a facet in
> elasticsearch.
> The mysql table with articels includes only one category-Id of the
> category-table.
>
> ID: 1 books (300)
> ID: 2 |-- fiction (200)
> ID: 3 |-- sience (100)
> ID: 4 |-- mathematics (50
> ID: 5 |-- biology (50)
>
>
>
> Thx for help,
> Stefan
>
>
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/4bf275c8-1cec-4993-9f92-d805c593b561%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/4bf275c8-1cec-4993-9f92-d805c593b561%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoFDsW_22-NtcNO2eP8gRS%2BNz9Qd%3DQqmW4avTcOv7n-E2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.