美文网首页
ES常用命令

ES常用命令

作者: 嘉宾 | 来源:发表于2021-08-06 22:23 被阅读0次

GET saasiotalertxx/_search

{

  "query": {

    "match_all": {}

  }

}

GET /saasiotalertx/_mapping

POST saasiotalertxx/_doc/_delete_by_query

{

  "query": {"match_all": {}}

}

POST saasiotalertxx/_doc/_delete_by_query

{

  "query": {"match_all": {}}

}

get systemoperationlog/_search

{

  "query": {

    "bool": {

      "must": [{

        "terms": {

          "projectCode": [

            "zh_00002_xm_00000001"

          ],

          "boost": 1.0

        }

      }],

      "adjust_pure_negative": true,

      "boost": 1.0

    }

  }

}

}

GET systemoperationlog/_analyze

{

    "analyzer": "standard",

    "text": "中文"

}

// 删除索引

DELETE /my_index

// 规范化索引 经过查找验证后发现出现该错误是因为5.x之后,Elasticsearch对排序、聚合所依据的字段用单独的数据结构(fielddata)缓存到内存里了,但是在text字段上默认是禁用的,这样做的目的是为了节省内存空间。所以如果需要进行聚合操作,需要单独开启。

PUT myindex/_mapping

{

  "properties": {

    "city": {

      "type":    "text",

      "fielddata": true

    }

  }

}

DELETE /saasiotalertx

DELETE /saasiotalertxx

DELETE systemoperationlog

PUT /saasiotalertx

PUT /saasiotalertxx

PUT /systemoperationlog

POST /saasiotalertx/_doc/_mapping?include_type_name=true

{

  "properties" : {

        "createTime" : {

          "type" : "date",

          "format" : "yyyy-MM-dd HH:mm:ss"

        },

        "logId" : {

          "type" : "text",

          "fields" : {

            "keyword" : {

              "type" : "keyword",

              "ignore_above" : 256

            }

          }

        },

        "ruleId" : {

          "type" : "text",

          "fields" : {

            "keyword" : {

              "type" : "keyword",

              "ignore_above" : 256

            }

          }

        },

        "status" : {

          "type" : "boolean"

        }

      }

}

插入数据

POST /saasiotalertxx/_doc

{

  "logId" : "07c76ff045d94acaa1c0397027c1eb851659677588848",

  "alarmId" : "2558985011638870017",

  "status" : true,

  "content" : "动作类型:生成告警视频&监控设备数量:1&监控设备:球机",

  "title" : "执行动作1",

  "createTime" : "2022-08-18 09:12:49"

}

相关文章

  • es常用命令

    curl 'localhost:9200/_cat/health?v' 可以看到,我们集群的名字是“elastic...

  • ES常用命令

    集群信息 索引命令 查询命名 查询所有 curl -XPOST ${ES_SEARCH} -d'{"query":...

  • ES常用命令

    get http://47.103.39.187:9200/_cat/indices?pretty 查看所有索引g...

  • ES常用命令

    mapping映射 更改映射属性--禁止动态增加 更改映射属性--增加域

  • ES常用命令

    GET saasiotalertxx/_search { "query": { "match_all": {...

  • es常用命令小结

    查看索引 删除索引 操作索引

  • ES查看分词结果|es字段类型修改|ES常用命令

    查看分词结果 sort脚本排序 修改mapping中的字段类型 此处示例index为:youdu(已存在) you...

  • 其他

    Git常用命令mac常用命令Linux 常用命令汇总Linux 常用命令0Linux 常用命令1--ls命令

  • ES6 - 常用命令

    1. 查看是否完成多节点的分布式部署 http://ip:9200/_cat/nodes 2. 通过下面命令查看各...

  • Docker

    目录 常用命令 常用命令

网友评论

      本文标题:ES常用命令

      本文链接:https://www.haomeiwen.com/subject/bvnivltx.html