elastic
- query_string语法: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html
- 索引别名和零停机: https://www.elastic.co/guide/cn/elasticsearch/guide/current/index-aliases.html
-
thread-pool: https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-threadpool.html#fixed-auto-queue-size
- ES重建索引语句示例
GET user_info/_mapping
PUT user_info_v1?pretty
{"settings": {"number_of_shards": 1, "analysis": {"analyzer": {"index_analyzer": {"type": "custom", "tokenizer": "ik_max_word", "char_filter": ["camel_case_filter"], "filter": ["lowercase", "autocomplete_filter"]}, "search_analyzer": {"type": "custom", "tokenizer": "ik_smart", "char_filter": ["camel_case_filter"], "filter": ["lowercase"]}}, "char_filter": {"camel_case_filter": {"type": "pattern_replace", "pattern": "(?<=\\p{Lower})(?=\\p{Upper})", "replacement": " "}}, "filter": {"autocomplete_filter": {"type": "edge_ngram", "min_gram": 1, "max_gram": 20}}}}}
PUT /user_info_v1/user_info/_mapping?pretty
{
"user_info": {
"properties": {
"name": {
"type": "text",
"analyzer": "index_analyzer",
"fields": {
"raw": {
"type": "keyword"
}
}
}
}
}
}
POST user_info_v1/user_info/_mapping
{
"user_info": {
"properties": {
"author_flag": {
"type": "long"
},
"avatar": {
"type": "keyword"
},
"ban_account_expire_time": {
"type": "long"
},
"ban_account_time": {
"type": "long"
},
"ban_expire_time": {
"type": "long"
},
"best_grade": {
"type": "long"
},
"channel_id": {
"type": "long"
},
"city": {
"type": "keyword"
},
"close_account_time": {
"type": "long"
},
"close_calm_time": {
"type": "long"
},
"common": {
"type": "keyword"
},
"credits_change_168h0m0s": {
"type": "long"
},
"daily_duration_1110": {
"type": "long"
},
"desc": {
"type": "keyword"
},
"district": {
"type": "keyword"
},
"done_post_test": {
"type": "long"
},
"grade": {
"type": "long"
},
"id": {
"type": "long"
},
"index": {
"properties": {
"routing": {
"properties": {
"allocation": {
"properties": {
"require": {
"properties": {
"temperature": {
"type": "keyword"
}
}
}
}
}
}
}
}
},
"is_fake": {
"type": "boolean"
},
"is_locked": {
"type": "boolean"
},
"last_update_time": {
"type": "long"
},
"latitude": {
"type": "float"
},
"login_time": {
"type": "long"
},
"longitude": {
"type": "float"
},
"main_uin": {
"type": "keyword"
},
"monday_to_now_duration": {
"type": "long"
},
"motto": {
"type": "keyword"
},
"msdk_appid": {
"type": "keyword"
},
"msdk_avatar": {
"type": "keyword"
},
"msdk_platid": {
"type": "long"
},
"msdk_token": {
"type": "keyword"
},
"name": {
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
},
"analyzer": "index_analyzer"
},
"nick_name": {
"type": "keyword"
},
"online_duration": {
"type": "long"
},
"operator": {
"type": "keyword"
},
"praise_num": {
"type": "long"
},
"province": {
"type": "keyword"
},
"push_dev_token": {
"type": "keyword"
},
"rank_online_duration": {
"type": "long"
},
"reg_platform": {
"type": "long"
},
"register_time": {
"type": "long"
},
"status": {
"type": "long"
},
"sub_credits:1": {
"type": "long"
},
"sub_credits:10": {
"type": "long"
},
"sub_credits:2": {
"type": "long"
},
"sub_credits:3": {
"type": "long"
},
"sub_credits:4": {
"type": "long"
},
"sub_credits:9": {
"type": "long"
},
"total_bounty": {
"type": "long"
},
"total_credits": {
"type": "long"
},
"total_reward": {
"type": "long"
},
"unban_account_time": {
"type": "long"
},
"user_id": {
"type": "long"
},
"v_flag": {
"type": "long"
},
"version": {
"type": "keyword"
}
}
}
}
POST _reindex
{
"source": {
"index": "user_info_v2"
},
"dest": {
"index": "user_info_v1"
}
}
// 新建别名
PUT /user_info_v1/_alias/user_info?pretty
// 更新别名
POST /_aliases
{
"actions" : [
{ "remove" : { "index" : "user_info_v2", "alias" : "user_info" } },
{ "add" : { "index" : "user_info_v1", "alias" : "user_info" } }
]
}