简体   繁体   English

elasticsearch 从文本中提取关键字

[英]elasticsearch extract keywords from text

I have more than 4000 keywords I want to indexed by elasticsearch.我有超过 4000 个关键字要由 elasticsearch 索引。 I want to pass it the text and extract the existing keywords.我想将文本传递给它并提取现有的关键字。 The first problem is that when I pass a few numbers it works but when I pass a lot of keywords it extracts words that are not in the text.第一个问题是,当我传递几个数字时它可以工作,但是当我传递很多关键字时,它会提取文本中没有的词。 The second problem is that it only extracts the words before and after space.第二个问题是它只提取空格前后的单词。 I want to extract keyword it from inside the word我想从单词中提取关键字

    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"
    }
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM