字典列表中的 Facet ElasticSearch(Python)

问题描述 投票:0回答:0

给出

索引中的数据看起来像

{
  "entity_tags": [
    {
      "tags": [
        "two",
        "three"
      ],
      "tag_data_type": "multitextselect",
      "tag_group_name": "one 3"
    },
    {
      "tags": [
        "new1"
      ],
      "tag_data_type": "textselect",
      "tag_group_name": "one"
    },
    {
      "tags": [
        "10"
      ],
      "tag_data_type": "counter",
      "tag_group_name": "new"
    }
  ],
  "class": "A"
}

我需要在 python 中编写一个 Elasticsearch 查询(方面),以便输出返回(需要返回所有可能的值)

  1. class: [A], # as class contains A option only
  2. new:[10] # new 仅包含 10 个选项
  3. one:[new1] # one 仅包含 new 和 new1 选项
  4. one 3:[three, two] # one 3 仅包含两个和三个选项

对于字典列表(这里是 entity_tags ),它应该返回所有带有可能标签值的 tag_group_name 值

python-3.x elasticsearch facet elasticsearch-aggregation faceted-search
© www.soinside.com 2019 - 2024. All rights reserved.