PUT /docname/_mapping/_doc
{
"properties": {
"xxx_type": {
"type": "keyword"
}
}
}
DELETE /docname
PUT /docname
{
"settings": {
"number_of_shards": "5",
"number_of_replicas": "0"
},
"mappings": {
"_doc": {
"dynamic": "strict",
"properties": {
"xname": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"aname": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"cname": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"err_msg": {
"type": "text"
},
"hid": {
"type": "long"
},
"oid": {
"type": "long"
},
"oaid": {
"type": "long"
},
"result": {
"type": "byte"
},
"run_time": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"sname": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"create_time": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"update_time": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
}
}
}
}
}
POST /docname/_doc
{
"xname": "计划名称1",
"run_time": "0000-01-01 00:00:00"
}
POST /docname/_doc/EippUYEBfjYkm2Z7kWAI/_update
{
"doc":{
"run_time" : "0000-01-01 00:00:00"
}
}
POST _bulk
{"index":{"_index":"docname","_type":"_doc"}}
{"a":"计划名称2","b":"广告主名称2","c":"广告组名称2","e":"","h":2,"oa":2,"oc":2,"od":2,"response":"","result":2,"run_time":"0000-01-01 00:00:00","sn":"策略名称2"}
{"index":{"_index":"docname","_type":"_doc"}}
{"a":"计划名称3","b":"广告主名称3","c":"广告组名称3","e":"","h":3,"ocean_ad_id":3,"oa":3,"oc":3,"response":"","result":3,"run_time":"0000-01-03 00:00:00","sn":"策略名称3"}
GET /docname/_search
{
"query": {
"bool": {
"filter": {
"term": {
"hid": 2
}
}
}
}
}
GET /docname/_search
{
"query": {
"bool": {
"filter": [
{
"term": {
"hid": 2
}
},
{
"range": {
"run_time": {
"gte": "0000-01-01 00:00:00"
}
}
}
]
}
}
}
GET /docname/_search
{
"query": {
"bool": {
"filter": {
"range": {
"run_time": {
"gte": "0000-01-01 00:00:00"
}
}
}
}
},
"aggs": {
"results": {
"terms": {
"field": "run_time"
},
"aggs": {
"hids": {
"terms": {
"field": "hid"
},
"aggs": {
"hits": {
"top_hits": {}
}
}
}
}
}
}
}
GET /docname/_search
{
"size": 0,
"query": {
"bool": {
"filter": {
"terms": {
"hid": [
3,
2
]
}
}
}
},
"aggs": {
"response": {
"composite": {
"sources": [
{
"run_time": {
"date_histogram": {
"field": "run_time",
"interval": "1s",
"format": "yyyy-MM-dd HH:mm:ss",
"order": "desc"
}
}
},
{
"hid": {
"terms": {
"field": "hid",
"order": "asc"
}
}
}
]
},
"aggs": {
"oaids": {
"terms": {
"field": "oaid",
"order": {
"_key": "asc"
}
},
"aggs": {
"success_num": {
"filter": {
"term": {
"result": 1
}
}
},
"data": {
"top_hits": {
"size": 10
}
}
}
},
"paginate": {
"bucket_sort": {
"from": 0,
"size": 10
}
}
}
},
"total": {
"cardinality": {
"script": "doc['run_time'] +'-'+ doc['hid']"
}
}
}
}
es6.8 curd
于 2022-06-11 16:06:01 首次发布