pkwenda

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

  •  
  •   pkwenda · Aug 6, 2020 · 4857 views
    This topic created in 2112 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
        1
    misaka19000  
       Aug 6, 2020   ❤️ 1
    index template
    pkwenda
        2
    pkwenda  
    OP
       Aug 6, 2020
    @misaka19000 #1 对哈
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3895 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 00:55 · PVG 08:55 · LAX 17:55 · JFK 20:55
    ♥ Do have faith in what you're doing.