appbaseio / appbaseio/reactivesearch
[Lists] Count top-level documents instead of nested documents when using nestedField
- 主要言語
- JavaScript
- スター
- 4.9k
- フォーク
- 478
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
**Affected Projects**
React / All
**Is your feature request related to a problem? Please describe.**
Nested fields count is based on nested documents. Would be great to have a way to switch it to count on the top-level document. This would apply to all lists with a count.
Example:
```
bookshelf1.books : [
{ book1: {author: "John Doe} },
{ book2: {author: "Rick Doe} },
{ book3: {author: "John Doe} },
],
bookshelf2.books : [
{ book1: {author: "Jane Doe} },
{ book2: {author: "Jane Doe} },
{ book3: {author: "John Doe} },
]
```
Currently, if filtering on `bookshelf.books.author`, one would get the following counts on "books":
```
John Doe 3
Jane Doe 2
Rick Doe 1
```
would be great to be able to switch to a count on "bookshelf":
```
John Doe 2
Jane Doe 1
Rick Doe 1
```
Ultimately, the results returns (unless using `inner_hits`) are based on the top-level document (`bookshelf`) in this example. Therefore, I think it feels more natural to display the count on them in many cases.
**Describe the solution you'd like**
One way would be to add a boolean prop e.g `reverseNestedCount` which would then change the aggregation method. To my knowledge there is currently no way to modify the aggregation used for counting but I could be wrong (?).
In ES, this would be achieved using a [reverse nested aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-reverse-nested-aggregation.html).
**Describe alternatives you've considered**
I guess the alternative would be to write a component from scratch
コントリビューションガイド
評価
この issue はまだ評価されていません。