Answer the question
In order to leave comments, you need to log in
How to select documents for a specific category with aggregation?
There is a portal for exhibiting auctions. Auction data (documents) is stored in the elasticsearch index. Each auction belongs to one category, which in turn has parent categories. IDs of child and parent categories are stored in a separate field of the auction document as a nested structure:
{
...
'categories': {
'level1': 3 // <- Категория аукциона (пример: видеокарты)
'level2': 34 // <- Родительская категория (пример: компоненты)
'level3': 152 // <- Родительская категория (пример: компьютеры)
}
...
}
Answer the question
In order to leave comments, you need to log in
If your category number is unique, then why did you split them into several properties? Wouldn't it be easier to just make the 'level':[3,34,152]
. Then the aggregation will be in one request!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question