elasticsearch从文本中提取关键字

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

我想通过Elasticsearch将4000多个关键字编入索引。我想将其传递给文本并提取现有的关键字。第一个问题是,当我传递一些数字时,它可以工作,但是当我传递许多关键字时,它会提取文本中没有的单词。第二个问题是它仅提取空格之前和之后的单词。我想从单词中提取关键字

elasticsearch indexing extract keyword
1个回答
0
投票
    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"
    }
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.