pkwenda

es 7.x 如何全局设置 custom analyzer ??

  •  
  •   pkwenda · Aug 6, 2020 · 8655 views
    This topic created in 2283 days ago, the information mentioned may be changed or developed.
    PUT _all
    {
      "settings": {
        "analysis": {
          "analyzer": {
            "my_analyzer": {
              "tokenizer": "ngram_one_word"
            }
          },
          "tokenizer": {
            "ngram_one_word": {
              "type": "ngram",
              "min_gram": 1,
              "max_gram": 16,
              "filter": [ "lowercase" ]
            }
          }
        }
      }
    }
    
    {
      "error": {
        "root_cause": [
          {
            "type": "invalid_index_name_exception",
            "reason": "Invalid index name [_all], must not start with '_', '-', or '+'",
            "index_uuid": "_na_",
            "index": "_all"
          }
        ],
        "type": "invalid_index_name_exception",
        "reason": "Invalid index name [_all], must not start with '_', '-', or '+'",
        "index_uuid": "_na_",
        "index": "_all"
      },
      "status": 400
    }
    
    

    不想一个一个设置,求解。

    另外问一下能像以前那样 在 elasticsearch.yml 里面全局设置吗 ?

    Supplement 1  ·  Aug 6, 2020
    *************************************************************************************
    Found index level settings on node level configuration.
    
    Since elasticsearch 5.x index level settings can NOT be set on the nodes
    configuration like the elasticsearch.yaml, in system properties or command line
    arguments.In order to upgrade all indices the settings must be updated via the
    /${index}/_settings API. Unless all settings are dynamic all indices must be closed
    in order to apply the upgradeIndices created in the future should use index templates
    to set default values.
    
    Please ensure all required values are updated on all indices by executing:
    
    curl -XPUT 'http://localhost:9200/_all/_settings?preserve_existing=true' -d '{
      "index.number_of_shards" : "3"
    }'
    *************************************************************************************
    

    5.0 以后就不让在 yml 设置 index相关配置了

    Supplement 2  ·  Aug 6, 2020
    恩,全网搜索了一下,没有任何办法,利用 api create mapping 的时候一个一个指定吧
    2 replies  •  2020-08-06 21:01:54 +08:00
    misaka19000
    misaka19000
    Aug 6, 2020❤️1
    1
    index template
    pkwenda
    pkwenda
    OP
    Aug 6, 2020
    2
    @misaka19000 #1 对哈
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1975 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 20ms · UTC 01:14 · PVG 09:14 · LAX 17:14 · JFK 20:14
    ♥ Do have faith in what you're doing.