【问题标题】:elasticsearch extract keywords from textelasticsearch 从文本中提取关键字
【发布时间】:2020-09-24 12:54:40
【问题描述】:

我有超过 4000 个关键字要被 elasticsearch 索引。 我想将文本传递给它并提取现有的关键字。 第一个问题是,当我传递几个数字时它可以工作,但是当我传递很多关键字时,它会提取文本中没有的词。 第二个问题是它只提取空格前后的单词。 我想从单词内部提取关键字它

【问题讨论】:

标签: elasticsearch indexing extract keyword


【解决方案1】:
    PUT test
{
  "settings": {
    "analysis": {
      "analyzer": {
        "my_analyzer_keyword": {
          "type": "custom",
          "tokenizer": "keyword",
          "filter": [
            "asciifolding",
            "lowercase"
          ]
        },
        "my_analyzer_shingle": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": [
            "asciifolding",
            "lowercase",
            "shingle"
          ]
        }
      }
    }
  }
}

POST /test/your_type/
{
  "keyword": "search"
}

POST /test/your_type/_search
{
  "query": {
    "match": {
      "keyword": "elasticsearch"
    }
  }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-17
    • 1970-01-01
    相关资源
    最近更新 更多