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

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

  •  
  •   pkwenda · 2020-08-06 20:10:55 +08:00 · 1877 次点击
    这是一个创建于 1356 天前的主题,其中的信息可能已经有所发展或是发生改变。

    腾讯云最新优惠活动来了:云产品限时1折,云服务器低至88元/年 ,点击这里立即抢购:9i0i.cn/qcloud,更有2860元代金券免费领取,付款直接抵现金用,点击这里立即领取:9i0i.cn/qcloudquan

    (福利推荐:你还在原价购买阿里云服务器?现在阿里云0.8折限时抢购活动来啦!4核8G企业云服务器仅2998元/3年,立即抢购>>>:9i0i.cn/aliyun

    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

    腾讯云最新优惠活动来了:云产品限时1折,云服务器低至88元/年 ,点击这里立即抢购:9i0i.cn/qcloud,更有2860元代金券免费领取,付款直接抵现金用,点击这里立即领取:9i0i.cn/qcloudquan

    (福利推荐:你还在原价购买阿里云服务器?现在阿里云0.8折限时抢购活动来啦!4核8G企业云服务器仅2998元/3年,立即抢购>>>:9i0i.cn/aliyun

    *************************************************************************************
    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   ·   我们的愿景   ·   实用小工具   ·   1048 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:08 · PVG 03:08 · LAX 12:08 · JFK 15:08
    Developed with CodeLauncher
    ? Do have faith in what you're doing.


    http://www.vxiaotou.com