ES
增删改后第一时间查询不到
PUT test_table/_settings
{
"settings": {"refresh_interval":"10ms"}
}
修改查询的数据
POST test_table/_update_by_query
{
"query": {
"bool": {
"must": {
{
"term": {
"tag.keyword": "测试"
}
}
}
},
"script": "ctx._source.atag='测试1';ctx._source.tag='测试2'"
}
聚合查询
GET /test_index/_search/
{
"size": 0,
"query": {
"bool": {
"must": {
{
"term": {
"tag.keyword": "测试"
}
},
{
"range":{
"xxtm":{
"gte": "2021-01-01 00:00:00",
"lte": "2021-01-31 23:59:59"
}
}
}
}
},
"aggs" : {
"xxtm_hour" : {
"date_histogram" : {
"field" : "xxtm",
"interval": "hour"
}
}
}
}
GET /test_index/_search/
{
"size": 0,
"query": {
"match_phrase": {
"tag": "测试"
}
},
"aggs" : {
"xxtm_hour" : {
"date_histogram" : {
"field" : "xxtm",
"interval": "hour"
}
}
}
}