欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

kibana操作ES

程序员文章站 2022-07-06 09:43:08
...

1.新建索引

在kibana里面

PUT /order_dev1/
{
  "settings":{
    "index":{
      "number_of_shards" : "3",
      "number_of_replicas" : "0"
    }
  }
}


PUT /order_dev1/_doc/_mappings?include_type_name=true
{
	"properties": {
		"id": {
			"type": "keyword"
		},
		"orderNo": {
			"type": "keyword"
		},
		"status": {
			"type": "text"
		},
		"pushed": {
			"type": "keyword"
		},

		"requestDecisionNo": {
			"type": "keyword"
		},
		"initParam": {
			"type": "keyword"
		},
		"customerId": {
			"type": "keyword"
		},
		"name": {
			"type": "keyword"
		},

		"channelId": {
			"type": "keyword"
		},
		"channelName": {
			"type": "keyword"
		},
    		"idCard": {
			"type": "keyword"
		},

		"phone": {
			"type": "text"
		},
		"operateType": {
			"type": "keyword"
		},
		"requestDecisionParam": {
			"type": "keyword"
		},
    		"requestManualParam": {
			"type": "keyword"
		},
    		"manualResult": {
			"type": "keyword"
		},
    		"decisionResult": {
			"type": "keyword"
		},
    		"sceneNo": {
			"type": "keyword"
		},
        		"artificialFlag": {
			"type": "keyword"
		},
        		"manualPushed": {
			"type": "keyword"
		},
		"createTime": {
			"type": "date",
			"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
		},
		"updateTime": {
			"type": "date",
			"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
		}
	}
}

使用kibana操作es

// 查看所有索引
GET /_cat/indices?v

// 创建指定索引 customer
PUT /customer?pretty

// 查看指定索引信息 customer
GET /customer/

// 查看指定索引数据信息
GET /customer/_search

// 给指定索引添加指定的id数据信息
PUT /customer/external/1
{
  "name": "John Doe"
}

// 查看指定索引的id   这里查看id为1的数据信息
GET /customer/external/1


// 删除指定索引信息
DELETE /customer?pretty

// 创建指定索引
PUT /demo?pretty

// 查看指定索引信息
GET /demo

// 创建结构化索引
PUT /demo/main_info/_mappings
{
  "properties": {
      "name": {
          "type": "text"
      },
      "country": {
          "type": "keyword"
      },
      "age": {
          "type": "integer"
      },
      "date": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
      }
  }
    
}

// 查看指定索引信息 此时可看到相应的结构化索引信息
GET /demo

PUT test/_doc/1
{
  "name": "乔哈哈",
  "age": 18,
  "birth": "2000-01-01"
}

使用kibana新增修改查询等操作Es

删除数据

DELETE /order_dev1/_doc/628314261984718880

索引名称,类型,id

相关标签: elasticsearch