请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

es7版本的问题

请问如图的错误,我大概理解7.0版本以上是不允许连词长度最大值与最小值相差超过1,那么我需要在语法中如何显示的去配置对应的允许跨越长度差值?
相关截图:

6251ce6228ca567505001000.jpg

正在回答 回答被采纳积分+3

2回答

rockybean 2022-04-10 16:23:46

可以用下面的方法测试

PUT test_ngram_filter
{
  "settings": {
    "index": {
      "max_ngram_diff": 10
    },
    "analysis": {
      "analyzer": {
        "my_custom_analyzer": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": [
            "stop",
            "lowercase",
            "3_5_grams"
          ]
        }
      },
      "filter": {
        "3_5_grams": {
          "type": "ngram",
          "min_gram": 3,
          "max_gram": 5
        }
      }
    }
  }
}

POST test_ngram_filter/_analyze
{
  "analyzer": "my_custom_analyzer",
  "text": "a Hello World"
}


0 回复 有任何疑惑可以回复我~
rockybean 2022-04-10 14:37:04

麻烦贴下文字版本,图片分辨率太低了,看不清楚

0 回复 有任何疑惑可以回复我~
  • 提问者 悟亦凡 #1
    请求样例:
    POST /_analyze
    {
      "text": ["a Hello World"],
      "tokenizer": "standard",
      "filter": [
        "stop",
        "lowercase",
        {
          "type":"ngram",
          "min_gram":2,
          "max_gram":4
        }
      ]
    }
    
    返回错误:
    {
      "error" : {
        "root_cause" : [
          {
            "type" : "illegal_argument_exception",
            "reason" : "The difference between max_gram and min_gram in NGram Tokenizer must be less than or equal to: [1] but was [2]. This limit can be set by changing the [index.max_ngram_diff] index level setting."
          }
        ],
        "type" : "illegal_argument_exception",
        "reason" : "The difference between max_gram and min_gram in NGram Tokenizer must be less than or equal to: [1] but was [2]. This limit can be set by changing the [index.max_ngram_diff] index level setting."
      },
      "status" : 400
    }
    回复 有任何疑惑可以回复我~ 2022-04-10 14:52:24
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信