简体   繁体   中英

elasticsearch extract keywords from text

I have more than 4000 keywords I want to indexed by 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"
    }
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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