如何查看已索引的分析数据?

2024-01-07

您如何查看索引某些内容后存储的分析数据。

我知道你可以像这样搜索一下

http://localhost:9200/local_products_fr/fields/_search/

但我想看到的是实际数据而不是_source

就像你调用 _analyzer 时得到的东西

http://localhost:9200/local_products_fr/_analyze?text=<p>my <b>super</b> text</p>&analyzer=analyzer_fr

{
  "tokens": [
    {
      "token": "my",
      "start_offset": 3,
      "end_offset": 5,
      "type": "<ALPHANUM>",
      "position": 0
    },
    {
      "token": "b",
      "start_offset": 7,
      "end_offset": 8,
      "type": "<ALPHANUM>",
      "position": 1
    },
    {
      "token": "sup",
      "start_offset": 9,
      "end_offset": 14,
      "type": "<ALPHANUM>",
      "position": 2
    },
    {
      "token": "b",
      "start_offset": 16,
      "end_offset": 17,
      "type": "<ALPHANUM>",
      "position": 3
    },
    {
      "token": "text",
      "start_offset": 19,
      "end_offset": 23,
      "type": "<ALPHANUM>",
      "position": 4
    }
  ]
}

我用它来获取每个文档的字段的倒排索引

{
    "query": {
        "bool": {
            "must": [{
                "term": {
                    "_id": {
                        "value": "2"
                    }
                }
            }]
        }
    },
    "script_fields": {
        "terms": {
            "script": "doc['product.name'].values"
        }
    }
}

希望这对你有用

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何查看已索引的分析数据? 的相关文章

随机推荐