zoukankan      html  css  js  c++  java
  • esDSLindex管理操作相关

    版本为7.3.2,主要记录index,settings,mappings相关的操作,方便快速测试,调试

    7版本已经不需要指定_doc属性,以下可忽略_doc

    获取某个索引的mapping信息

    get    http://10.192.78.27:39200/<index_name>/_mapping

    创建一个动态mapping的index,并指定某些字段,并允许新字段

    put    http://10.192.78.27:39200/<index_name>

    {
      "mappings": {
         "dynamic": "true",
         "properties": {
            "id":{ "type":"keyword"},
            "rule_name": { "type": "keyword" },
            "metric_threshold":{ "type":"integer"},
            "audit_status":{"type": "integer"},
            "audit_comment_num":{"type":"integer"},
            "metric_count":{"type":"integer"},
            "window_start":{"type":"date"},
            "window_end":{"type":"date"}
        }
      }
    }

    在当前索引的mapping下新增加一个字段

    加一个指定了format的date类型字段window_start

    PUT   http://10.192.78.27:39200/<index_name>/_mapping/

    {
       "properties": {
          "window_start": {
             "type": "date",
             "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd'T'HH:mm:ss.SSSZ"
          }
       }
    }

    date类型字段问题

    format属性官网地址:https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html#date-params

    自定义时间格式属性:https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html

    PUT index_name
    {
        "mappings": {
            "_doc": {
                "properties": {
                    "create_time": {
                          "type": "date",
                          "format": "yyyy-MM-dd HH:mm:ss||epoch_millis"
                      }
                 }
            }
        }
    }    

    删除索引(一般都会设置禁止批量删除.....)

    DELETE    http://10.192.78.27:39200/<index_name>

  • 相关阅读:
    【HDOJ】2774 Shuffle
    【POJ】2170 Lattice Animals
    【POJ】1084 Square Destroyer
    【POJ】3523 The Morning after Halloween
    【POJ】3134 Power Calculus
    【Latex】如何在Latex中插入伪代码 —— clrscode3e
    【HDOJ】4801 Pocket Cube 的几种解法和优化
    【HDOJ】4080 Stammering Aliens
    【HDOJ】1800 Flying to the Mars
    SQL语法
  • 原文地址:https://www.cnblogs.com/yb38156/p/15752127.html
Copyright © 2011-2022 走看看