美文网首页
Elasticsearch让你的Ik分词器支持特殊符号和驼峰分词

Elasticsearch让你的Ik分词器支持特殊符号和驼峰分词

作者: yuerumylove | 来源:发表于2019-07-15 16:30 被阅读0次
    {
      "settings": {
        "index.number_of_shards": 3,
        "index.max_result_window": 20000000,
        "number_of_replicas": 1,
        "index.refresh_interval": "60s",
        "index.highlight.max_analyzed_offset": "10000",
        "analysis": {
          "analyzer": {
            "my_analyzer": {
              "tokenizer": "ik_max_word",
              "char_filter": [
                "camel_case_filter",
                "special_character_filter"
              ]
            }
          },
          "char_filter": {
            "camel_case_filter": {
              "type": "pattern_replace",
              "pattern": "(?<=\\p{Lower})(?=\\p{Upper})",
              "replacement": " "
            },
            "special_character_filter": {
                "type": "pattern_replace",
                "pattern": "(?:\\p{Punct})", 
                "replacement" : " "
            }
          }
        }
      },
      "mappings": {
        "record": {
          "_all" : { "enabled" : false },
          "dynamic": true,
          "date_detection": true,
          "properties": {
            "id": {
              "type": "keyword",
              "index": true
            },
          "record" : {
              "type": "text",
              "index": "true",
              "analyzer": "my_analyzer",
              "search_analyzer" : "ik_smart",
              "fields": {
                "exact": {
                  "type": "keyword"
                }
              },
              "fielddata": true
            }
          }
        }
      }
    }
    
    

    相关文章

      网友评论

          本文标题:Elasticsearch让你的Ik分词器支持特殊符号和驼峰分词

          本文链接:https://www.haomeiwen.com/subject/cgonkctx.html