ES创建索引

wylc123 1年前 ⋅ 707 阅读
PUT / mix_data {
	"mappings": {
		"properties": {
			"abstract": {
				"type": "text",
				"fields": {
					"keyword": {
						"type": "keyword"
					},
					"suggestion": {
						"type": "completion",
						"analyzer": "my_lowercase_analyzer",
						"preserve_separators": true,
						"preserve_position_increments": true,
						"max_input_length": 50
					}
				},
				"analyzer": "my_lowercase_analyzer"
			},
			"authors": {
				"type": "text",
				"fields": {
					"keyword": {
						"type": "keyword"
					},
					"pinyin": {
						"type": "text",
						"analyzer": "my_pinyin_analyzer"
					},
					"suggestion": {
						"type": "completion",
						"analyzer": "simple",
						"preserve_separators": true,
						"preserve_position_increments": true,
						"max_input_length": 50
					}
				},
				"analyzer": "ik_max_word",
				"search_analyzer": "ik_smart"
			},
			"country_name": {
				"type": "text",
				"fields": {
					"keyword": {
						"type": "keyword"
					},
					"pinyin": {
						"type": "text",
						"analyzer": "my_pinyin_analyzer"
					},
					"suggestion": {
						"type": "completion",
						"analyzer": "simple",
						"preserve_separators": true,
						"preserve_position_increments": true,
						"max_input_length": 50
					}
				},
				"analyzer": "ik_max_word",
				"search_analyzer": "ik_smart"
			},
			"create_time": {
				"type": "text",
				"fields": {
					"keyword": {
						"type": "keyword",
						"ignore_above": 256
					}
				}
			},
			"keyword": {
				"type": "text",
				"fields": {
					"keyword": {
						"type": "keyword"
					},
					"suggestion": {
						"type": "completion",
						"analyzer": "my_lowercase_analyzer",
						"preserve_separators": true,
						"preserve_position_increments": true,
						"max_input_length": 50
					}
				},
				"analyzer": "my_lowercase_analyzer",
				"search_analyzer": "ik_smart"
			},
			"lang": {
				"type": "text",
				"fields": {
					"keyword": {
						"type": "keyword",
						"ignore_above": 256
					}
				}
			},
			"mix_data_id": {
				"type": "integer"
			},
			"del": {
				"type": "integer"
			},
			"title": {
				"type": "text",
				"fields": {
					"keyword": {
						"type": "keyword"
					},
					"pinyin": {
						"type": "text",
						"analyzer": "my_pinyin_analyzer"
					},
					"suggestion": {
						"type": "completion",
						"analyzer": "simple",
						"preserve_separators": true,
						"preserve_position_increments": true,
						"max_input_length": 50
					},
					"synonym": {
						"type": "text",
						"analyzer": "ik_max_word",
						"search_analyzer": "ik_sync_smart"
					}
				},
				"analyzer": "ik_max_word",
				"search_analyzer": "ik_smart"
			},
			"content": {
				"type": "text",
				"fields": {
					"synonym": {
						"type": "text",
						"analyzer": "ik_max_word",
						"search_analyzer": "ik_sync_smart"
					}
				},
				"analyzer": "ik_max_word",
				"search_analyzer": "ik_smart"
			},
			"translate_content": {
				"type": "text",
				"fields": {
					"synonym": {
						"type": "text",
						"analyzer": "ik_max_word",
						"search_analyzer": "ik_sync_smart"
					}
				},
				"analyzer": "ik_max_word",
				"search_analyzer": "ik_smart"
			},
			"update_time": {
				"type": "date",
        		"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
			}
		}
	},
	"settings": {
		"index.max_result_window": 20000000,
		"analysis": {
			"filter": {
				"word_sync": {
					"type": "synonym_graph",
					"synonyms_path": "analysis/avic_syno_word.dic"
				}
			},
			"analyzer": {
				"my_pinyin_analyzer": {
					"tokenizer": "my_pinyin"
				},
				"ik_sync_smart": {
					"filter": ["word_sync"],
					"type": "custom",
					"tokenizer": "ik_smart"
				},
				"my_lowercase_analyzer": {
					"filter": ["lowercase"],
					"type": "custom",
					"tokenizer": "keyword"
				}
			},
			"tokenizer": {
				"my_pinyin": {
					"keep_joined_full_pinyin": "true",
					"keep_none_chinese_in_first_letter ": "false",
					"lowercase": "true",
					"none_chinese_pinyin_tokenize": "false",
					"keep_original": "true",
					"remove_duplicated_term": "true",
					"keep_separate_first_letter": "false",
					"trim_whitespace": "true",
					"type": "pinyin",
					"limit_first_letter_length": "255",
					"keep_none_chinese_in_joined_full_pinyin": "false",
					"keep_none_chinese_together": "false",
					"keep_first_letter": "false",
					"keep_none_chinese": "false",
					"keep_full_pinyin": "true"
				}
			}
		}
	}
}

查看索引及结构:

命令: GET /索引名/_mapping?pretty


相关文章推荐

全部评论: 0

    我有话说: