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>

  • 相关阅读:
    PsySH——PHP交互式控制台
    CentOS 6.5升级Python和安装IPython
    yii2 邮件发送
    Centos 6.5安装最新版谷歌浏览器-Chrome
    centos 6.5 设置屏幕保护
    PHP实现生成唯一编号(36进制的不重复编号)
    十位用户唯一ID生成策略
    0基础学java_for循环
    0基础学java_while循环
    0基础学java_逻辑变量 逻辑表达式 和条件句
  • 原文地址:https://www.cnblogs.com/yb38156/p/15752127.html
Copyright © 2011-2022 走看看