索引和结点健康
GET _cat/indices_
GET /_cat/health?v_
范围查询并关键字排序
GET idms_features/_search
{
"size" : 199,
"query" : {
"bool" : {
"filter" : [
{
"range" : {
"createTime" : {
"from" : 0,
"to" : 1599649933479,
"include_lower" : true,
"include_upper" : false,
"boost" : 1.0
}
}
}
],
"disable_coord" : false,
"adjust_pure_negative" : true,
"boost" : 1.0
}
},
"sort" : [
{
"createTime" : {
"order" : "desc"
}
}
]
}
录入
POST idms_features/idms
{
"industryName": "电力",
"level": 4,
"subClass": 6,
"subClassName": "研发设计数据",
"typeName": "流量特征指纹",
"industry": 13,
"remark": "",
"classification": 1,
"type": 1,
"library": 1,
"form": 2,
"createTime": 1589954715917,
"classificationName": " 研发类",
"formName": "工业协议流量数据",
"word": "反向有功电能",
"ruleId":11223
}
GET idms_features/_search_
{
"from" : 0,
"size" : 100,
"query" : {
"bool" : {
"filter" : [
{
"range" : {
"createTime" : {
"from" : 0,
"to" : 1599645870482,
"include_lower" : true,
"include_upper" : false,
"boost" : 1.0
}
}
}
],
"disable_coord" : false,
"adjust_pure_negative" : true,
"boost" : 1.0
}
},
"_source" : {
"includes" : [ ],
"excludes" : [ ]
}
}_
查询ruleId的关键字,并移除
POST /idms_features/_update_by_query
{
"script": {
"inline": "ctx._source.remove(\"ruleId\")"
},
"query": {
"bool": {
"must": [
{
"exists": {
"field": "ruleId"
}
}
]
}
}
}
移除某个?
POST /idms_features/AXKW7EXKo8A2dtevfTI9/_update
{
"script" : "ctx._source.remove(\"ruleId\")"
}
是否存在关键字查询
GET idms_features/_search
{
"query": {
"bool": {
"must": [
{
"exists": {
"field": "ruleId"
}
}
]
}
}
}
写入
curl -XPOST http://localhost:9200/bigdata/product/ -d '{"author" : "Doug Cutting"}'
curl -XPOST '192.168.21.134:9200/events_202006/event/ -d '{}'
条件查询
curl -XGET http://192.168.21.134:9200/events_202006/event/_search?pretty -H 'Content-Type: application/json' -d '
{
"query":
{"match":
{"dst_city":140921}
}
}'
插入记录
# 9200/索引库名/文档类型/id/ -d 文档内容
# id可以忽略,ES会自动生成id,如果id存在,那么就是更新数据,字段可以增加
curl -XPOST 'http://hadoop137:9200/upuptop/stu/1?pretty' -H 'Content-Type: application/json' -d '
{
"name":"shaofei",
"age":22,
"sex":1
}'
修改记录
# 给id为1的学生修改姓名为upuptop,年龄修改为25,添加学号字段
curl -XPOST 'http://hadoop137:9200/upuptop/stu/1?pretty' -H 'Content-Type: application/json' -d '
{
"name":"upuptop",
"age":25,
"sex":0,
"number":"1501260222"
}'
···