V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
pkwenda
V2EX  ›  Elasticsearch

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

  •  
  •   pkwenda · 2020-08-06 20:10:55 +08:00 · 1855 次点击
    这是一个创建于 1331 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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 里面全局设置吗 ?

    第 1 条附言  ·  2020-08-06 20:44:07 +08:00
    *************************************************************************************
    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相关配置了

    第 2 条附言  ·  2020-08-06 20:48:40 +08:00
    恩,全网搜索了一下,没有任何办法,利用 api create mapping 的时候一个一个指定吧
    2 条回复    2020-08-06 21:01:54 +08:00
    misaka19000
        1
    misaka19000  
       2020-08-06 20:57:15 +08:00   ❤️ 1
    index template
    pkwenda
        2
    pkwenda  
    OP
       2020-08-06 21:01:54 +08:00
    @misaka19000 #1 对哈
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2783 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 12:51 · PVG 20:51 · LAX 05:51 · JFK 08:51
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.