1. Index 란?
- DataBase 와 유사
- API 로 설정 가능
2. Index 설정
- PUT [색인명] 을 통하여 생성 가능
- shard와 replica 갯수를 설정
PUT tripdoc
{
"settings": {
"index":{
"number_of_shards":5,
"number_of_replicas":1
}
}
}
- 추가로 Mapping 을 지정할 수 있다.
PUT tripdoc
{
"mappings": {
"properties": {
"id": {
"type": "keyword"
},
"trip_id": {
"type": "long"
},
"title": {
"type": "text",
"copy_to": ["eng_kor_title_suggest", "chosung_title", "eng_title"],
"analyzer": "korean_analyzer"
},
"eng_title": {
"type": "text",
"analyzer": "standard",
"search_analyzer": "standard"
},
"eng_kor_title_suggest": {
"type": "text",
"analyzer": "korean_analyzer",
"search_analyzer": "eng2kor_analyzer"
},
"chosung_title": {
"type": "text",
"analyzer": "chosung_analyzer",
"search_analyzer": "standard"
},
"content": {
"type": "text",
"analyzer": "korean_analyzer"
},
"cost": {
"type": "integer"
},
"area": {
"type": "keyword",
"copy_to": ["eng_kor_area_suggest", "chosung_area"]
},
"eng_kor_area_suggest": {
"type": "text",
"search_analyzer": "eng2kor_analyzer"
},
"chosung_area": {
"type": "text",
"analyzer": "chosung_analyzer",
"search_analyzer": "keyword"
},
"hashtag": {
"type": "keyword",
"copy_to": ["eng_kor_hashtag_suggest", "chosung_hashtag"]
},
"eng_kor_hashtag_suggest": {
"type": "text",
"search_analyzer": "eng2kor_analyzer"
},
"chosung_hashtag": {
"type": "text",
"analyzer": "chosung_analyzer",
"search_analyzer": "keyword"
},
"trip_start_date": {
"type": "date",
"format": "yyyy-MM-dd"
},
"trip_end_date": {
"type": "date",
"format": "yyyy-MM-dd"
},
"created_at": {
"type": "date",
"format": "date_hour_minute_second"
},
"address": {
"type": "text"
},
"place_name": {
"type": "keyword"
},
"thumbnail_url": {
"type": "keyword"
},
"email": {
"type": "keyword"
},
"is_public": {
"type": "boolean"
}
}
},
"settings": {
"index":{
"number_of_shards":5,
"number_of_replicas":1,
"analysis":{
"tokenizer":{
"nori_custom_tokenizer":{
"type": "nori_tokenizer",
"decompound_mode": "mixed"
}
},
"analyzer":{
"kor2eng_analyzer":{
"type": "custom",
"tokenizer" : "standard",
"filter":[
"trim",
"lowercase",
"javacafe_kor2eng"
]
},
"eng2kor_analyzer":{
"type": "custom",
"tokenizer": "standard",
"filter":[
"trim",
"lowercase",
"javacafe_eng2kor"
]
},
"chosung_analyzer":{
"type": "custom",
"tokenizer": "standard",
"filter":[
"javacafe_chosung_filter",
"trim",
"lowercase",
"pos_filter_speech"
]
},
"chosung_search_analyzer":{
"type": "custom",
"tokenizer": "standard",
"filter":[
"javacafe_chosung_filter",
"trim",
"lowercase"
]
},
"korean_analyzer":{
"tokenizer": "nori_custom_tokenizer",
"filter":[
"pos_filter_speech",
"nori_readingform",
"lowercase"
]
}
},
"filter": {
"pos_filter_speech":{
"type": "nori_part_of_speech",
"stoptags":[
"E",
"IC",
"J",
"MAG",
"MAJ",
"MM",
"NA",
"NR",
"SC",
"SE",
"SF",
"SH",
"SL",
"SN",
"SP",
"SSC",
"SSO",
"SY",
"UNA",
"UNKNOWN",
"VA",
"VCN",
"VCP",
"VSV",
"VV",
"VX",
"XPN",
"XR",
"XSA",
"XSN",
"XSV"
]
},
"javacafe_chosung_filter":{
"type": "javacafe_chosung"
}
}
}
}
}
}
- DELETE [색인명] 으로 색인을 삭제 할 수 있다.
'ELK > Elasticsearch' 카테고리의 다른 글
[Elasticsearch] 검색 (0) | 2024.05.06 |
---|---|
[Elasticsearch] Mapping 정의 (1) | 2024.05.06 |
[Elasticsearch] 엘라스틱 서치란? (1) | 2024.05.06 |