es 更新索引mapping和setting

发布于:2024-06-25 ⋅ 阅读:(141) ⋅ 点赞:(0)

1.关闭索引

curl -X POST "localhost:9200/your_index_name/_close"

2.修改setting 配置

无法更新一些默认数据,按照需求构建,我这边是构建增加了分词器
 

"settings": {
			"index": {
				"creation_date": "1718850346547",
				"number_of_replicas": "1",
				"number_of_shards": "5",
				"provided_name": "v1",
				"uuid": "4wEGu-5SRTiva8OY66YnCw",
				"version": {
					"created": "7100299"
				}
			}
		}

更新:

curl -X POST "localhost:9200/your_index_name/_settings"

{
			"index": {
				"analysis": {
					"analyzer": {
						"ik": {
							"tokenizer": "ik_max_word"
						},
						"ts_ik_max_word": {
							"char_filter": [
								"tsconvert"
							],
							"filter": [
								"hotel_synonym",
								"py"
							],
							"tokenizer": "ik_max_word",
							"type": "custom"
						},
						"ts_ik_smart": {
							"char_filter": [
								"tsconvert"
							],
							"filter": [
								"hotel_synonym"
							],
							"tokenizer": "ik_smart",
							"type": "custom"
						}
					},
					"char_filter": {
						"tsconvert": {
							"convert_type": "t2s",
							"type": "stconvert"
						}
					},
					"filter": {
						"hotel_synonym": {
							"type": "dynamic_synonym"
						},
						"py": {
							"keep_full_pinyin": "false",
							"keep_joined_full_pinyin": "true",
							"keep_original": "true",
							"limit_first_letter_length": "16",
							"none_chinese_pinyin_tokenize": "false",
							"remove_duplicated_term": "true",
							"type": "pinyin"
						}
					}
				},
				"mapping": {
					"total_fields": {
						"limit": "100000"
					}
				}
				
			}
		}

3.更新mapping

curl -X POST "localhost:9200/your_index_name/_mapping"

4.打开索引
 

curl -X POST "localhost:9200/your_index_name/_open"


网站公告

今日签到

点亮在社区的每一天
去签到