티스토리 뷰
인덱스의 Type의 매핑을 변경하려면 새 인덱스를 만들어서 재인덱싱을 해 주는 수 밖에 없으며 방법은 아래와 같습니다.
기존 인덱스명 보존은 별칭(alias)으로 설정하여 해결합니다.
현재 인덱스
news-2018
새 인덱스 news_2018_v2 새 설정/매핑으로 생성
PUT /news_2018_v2
{
"settings": {
"analysis": {
"analyzer": {
"my_ngram_analyzer": {
"tokenizer": "my_ngram_tokenizer"
},
"openkorean_analyzer": {
"type": "custom",
"tokenizer": "openkoreantext-tokenizer",
"filter": [
"openkoreantext-redundant-filter", "openkoreantext-phrase-extractor"
]
},
"arirang": {
"tokenizer": "arirang_tokenizer",
"filter": [
"trim", "lowercase", "arirang_filter", "my_stop"
]
}
},
"tokenizer": {
"my_ngram_tokenizer": {
"type": "nGram",
"min_gram": "2",
"max_gram": "10",
"token_chars": [
"letter", "digit"
]
}
}
}
},
"mappings": {
"articleFs": {
"properties": {
"code2": {
"type": "keyword"
},
"imgStr2": {
"type": "text"
},
"watermarkCode": {
"type": "integer"
},
"gizaName": {
"type": "keyword"
},
"publishDate": {
"null_value": "NULL",
"format": "yyyyMMddHHmmss||yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||strict_date_optional_time||epoch_millis",
"ignore_malformed": true,
"type": "date"
},
"itCateCode": {
"type": "text"
},
"itCateCode2": {
"type": "keyword"
},
"body": {
"analyzer": "my_ngram_analyzer",
"type": "text"
},
"itCateCode3": {
"type": "keyword"
},
"title": {
"analyzer": "my_ngram_analyzer",
"type": "text"
},
"gizaDuty": {
"type": "keyword"
},
"keyword": {
"type": "text"
},
"loginId2": {
"type": "keyword"
},
"publishStatus": {
"type": "keyword"
},
"uidx": {
"store": true,
"type": "keyword"
},
"status6": {
"type": "integer"
},
"gizaLoginId": {
"type": "keyword"
},
"date2": {
"null_value": "NULL",
"format": "yyyyMMddHHmmss||yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||strict_date_optional_time||epoch_millis",
"ignore_malformed": true,
"type": "date"
},
"status2": {
"type": "integer"
},
"occurDate": {
"null_value": "NULL",
"format": "yyyyMMddHHmmss||yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||strict_date_optional_time||epoch_millis",
"ignore_malformed": true,
"type": "date"
},
"seArticleUidx": {
"type": "keyword"
},
"status3": {
"type": "integer"
},
"status4": {
"type": "integer"
},
"status5": {
"type": "integer"
},
"relOnkItemsStr": {
"type": "keyword"
},
"status": {
"type": "integer"
}
}
}
}
}
Reindexing data
POST _reindex
{
"source": {
"index": "news-2018"
},
"dest": {
"index": "news_2018_v2"
}
}
기존 인덱스 제거
DELETE news-2018
새 인덱스에 기존 인덱스를 호환 위한 별칭(alias) 설정
POST _aliases
{
"actions": [
{
"add": {
"index": "news_2018_v2",
"alias": "news-2018"
}
}
]
}
참고:
'OS-서버-서비스 > Elasticsearch' 카테고리의 다른 글
| ElasticSearch 한국어 형태소 분석기 설정 (0) | 2018.05.21 |
|---|---|
| ElasticSearch Index settings 변경 (0) | 2018.05.21 |
댓글
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- IE
- JQuery
- javascript
- Mac
- Linux
- iphone
- Wordpress
- classic asp
- iis
- ASP
- IOS
- nginx
- Docker
- API
- git
- Prototype
- CSS
- JSON
- 한글
- laravel
- sencha touch
- nodejs
- centos
- macos
- Android
- PHP
- Debug
- 워드프레스
- 안드로이드
- mssql
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
글 보관함