有没有一种方法可以查询继承假设的数据



如果我有处理继承的数据,并且我想查询继承,我如何使用elasticsearch。。。示例

all dealerships
* ford cars
* chevy cars
|
- Oregon Dealerships
* no ford cars
* mazda cars
|
- Portland dealership
|   * ford cars
|
- Salem dealership
* subaru cars
Show me all dealerships with ford/mazda/chevy
(Portland)
Show me all dealerships with chevy/Subaru
(Salem)

Show me all dealerships with ford
(all*)(portland)
* assume buckets can be returned as well as dealerships

Show me all dealerships

有没有一种方法可以在弹性搜索中实现这一点?

您可以使用嵌套映射来实现这一点:https://www.elastic.co/guide/en/elasticsearch/reference/current/nested.html

创建索引后,数据将填充到映射的索引中。

然后可以进一步使用嵌套查询:https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-query.html

嵌套查询将帮助您获得问题中提到的结果。

最新更新