赞
踩
目录
put http://{ip}:{port}/{index}/_mapping/{type} 其中,index是es索引、type是类型
数据:
- {
- "_doc": {
- "properties": {
- "report_time": {
- "type": "long"
- }
- }
- }
- }
例子:
注意:如果报错Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true
需要在url后面加上 ?include_type_name=true
post http://{ip}:{port}/{index}/_update/{id} 其中,index是es索引、id是文档_id
数据:
- {
- "doc": {
- "report_time": 1701315235000
- }
- }
样例:
post http://{ip}:{port}/{index}/_update_by_query 其中,index是es索引
数据:把command_status字段等于1的数据的ip_address字段修改为2.2.2.2
- {
- "query": {
- "match": {
- "command_status": 1
- }
- },
- "script": {
- "inline": "ctx._source['ip_address'] = '2.2.2.2'"
- }
- }
如果需要修改索引里所有数据,去掉query即可
- {
- "script": {
- "inline": "ctx._source['ip_address'] = '2.2.2.2'"
- }
- }
post http://{ip}:{port}/{index}/_update_by_query 其中,index是es索引
数据: 删除ip_address字段
- {
- "script": "ctx._source.remove('{ip_address}')",
- "query": {
- "bool": {
- "must": [
- {
- "exists": {
- "field": "ip_address"
- }
- }
- ]
- }
- }
- }
delete http://{ip}:{port}/{index}/{type}/{id} 其中,index是es索引、type是类型、id是文档_id
数据:无
post http://{ip}:{port}/{index}/_delete_by_query 其中,index是es索引
数据:删除command_id等于1G7ZACL800908的数据或文档
- {
- "query": {
- "match": {
- "command_id": "1G7ZACL800908"
- }
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。