关闭所有myidx-开头的索引的refresh(数据写入后没refresh就搜索不出来)

    1. #PUT myidx-*/_settings
    2. {
    3. "index": {
    4. "refresh_interval": "-1"
    5. }
    6. }

    配置分片(shard)数,副本(replica)数,并配置作为写索引加入到别名(alias) myidx

    1. #PUT myidx-write
    2. {
    3. "settings" : {
    4. "index" : {
    5. "number_of_shards": 1,
    6. "number_of_replicas": 0
    7. }
    8. },
    9. "aliases": {
    10. "myidx": {"is_write_index": true}
    11. }
    12. }

    :::tips 注意number_of_shards只能在创建index的时候配置 :::