有index test_user_index
GET test_user_index/_doc/{id}
GET /test_order_index/_search
{
"size": 0, // 控制返回的文本数
"query": {
"terms": {
"doc_id ": ["doc_id1", "doc_id2", "doc_id3"]
}
},
"aggs": {
"company_stats": {
"terms": {
"field": "doc_id",
"size": 10
},
"aggs": {
"total_amount": {
"sum": {
"field": "amount"
}
},
"total_count": {
"value_count": {
"field": "count"
}
},
"distinct_win_companies": {
"cardinality": {
"field": "corp_id"
}
}
}
}
}
}
GET /test_order_index/_search
{
"size": 0,
"aggs": {
"agg_label": {
"terms": {
"field": "city",
"size": 500 // 控制聚合返回的条数,根据实际情况
}
}
}
}
GET /test_order_index/_search
{
"query": {
"bool": {
"must_not": {
"term": {
"test": "true"
}
}
}
}
}
POST /_aliases
{
"actions": [
{
"add": {
"index": "your_index",
"alias": "your_alias"
}
}
]
}
POST /_aliases
{
"actions": [
{
"remove": {
"index": "your_current_index",
"alias": "your_alias"
}
},
{
"add": {
"index": "your_new_index",
"alias": "your_alias"
}
}
]
}