0

我非常喜欢为我的期望输出拆分数据。但我无法得到它。我尝试了所有的过滤器和分词器。我已经更新了弹性搜索中的设置,如下所示。

    {
      "settings": {
        "analysis": {
          "filter": {
            "filter_word_delimiter": {
                                "preserve_original": "true",
                                "type": "word_delimiter"
                    }
          },
          "analyzer": {
            "en_us": {
              "tokenizer":  "keyword",
              "filter":   [ "filter_word_delimiter","lowercase" ]
            }

          }
        }
      }
    }

执行的查询 curl -XGET "XX.XX.XX.XX:9200/keyword/_analyze?pretty=1&analyzer=en_us" -d 'DataGridControl'

命中值

{
  "tokens" : [ {
    "token" : "datagridcontrol"
    "start_offset" : 0,
    "end_offset" : 16,
    "type" : "word",
    "position" : 1
  }, {
    "token" : "data",
    "start_offset" : 0,
    "end_offset" : 4,
    "type" : "word",
    "position" : 1
  }, {
    "token" : "grid",
    "start_offset" : 4,
    "end_offset" : 8,
    "type" : "word",
    "position" : 2
  }, {
    "token" : "control",
    "start_offset" : 9,
    "end_offset" : 16,
    "type" : "word",
    "position" : 3
  } ]
}

预期结果,如 -> DataGridControl DataGrid DataControl 数据网格控件 将什么类型的标记器和过滤器添加到索引设置。有什么帮助吗?

4

1 回答 1

1

尝试这个:

{
  "settings": {
    "analysis": {
      "filter": {
        "filter_word_delimiter": {
          "type": "word_delimiter"
        },
        "custom_shingle": {
          "type": "shingle",
          "token_separator":"",
          "max_shingle_size":3
        }
      },
      "analyzer": {
        "en_us": {
          "tokenizer": "keyword",
          "filter": [
            "filter_word_delimiter",
            "custom_shingle",
            "lowercase"
          ]
        }
      }
    }
  }
}

如果它让你更接近,请告诉我。

于 2015-01-06T12:29:58.700 回答