zoukankan      html  css  js  c++  java
  • 索引生命周期的管理

     

     

     

     

     

     

     

     

     

     

     

     

     

    测试代码

     

     

     接下来创建索引模板

     

     

    PUT _cluster/settings
    {
      "persistent": {
        "indices.lifecycle.poll_interval":"1s"
      }
    }
    
    PUT /_ilm/policy/nginx_ilm_policy
    {
      "policy": {
        "phases": {
          "hot": {
            "actions": {
              "rollover": {
                "max_docs": "10"
              }
            }
          },
          "warm": {
            "min_age": "5s",
            "actions": {
              "allocate": {
                "include": {
                  "box_type": "warm"
                }
              }
            }
          },
          "cold": {
            "min_age": "20s",
            "actions": {
              "allocate": {
                "include": {
                  "box_type": "cold"
                }
              }
            }
          },
          "delete": {
            "min_age": "40s",
            "actions": {
              "delete": {}
            }
          }
        }
      }
    }
    
    PUT /_template/nginx_ilm_template
    {
      "index_patterns": ["nginx_logs-*"],                 
      "settings": {
        "number_of_shards": 1,
        "number_of_replicas": 0,
        "index.lifecycle.name": "nginx_ilm_policy",      
        "index.lifecycle.rollover_alias": "nginx_logs",
        "index.routing.allocation.include.box_type": "hot"
      }
    }
    
    PUT nginx_logs-000001
    {
      "aliases": {
        "nginx_logs": {
          "is_write_index":true
        }
      }
    }
    
    POST nginx_logs/_doc
    {
      "name":"abbc"
    }
    
    GET nginx_logs/_search
  • 相关阅读:
    210
    209
    208
    207
    定时任务crontab
    Python的zip与*zip函数的应用
    Python的reduce函数与map函数
    解析:cpu与io密集在何场景适合使用多进程,多线程,协程
    Python上下文(转载)
    C10K与C10M的问题
  • 原文地址:https://www.cnblogs.com/kebibuluan/p/13844318.html
Copyright © 2011-2022 走看看