Skip to content

Instantly share code, notes, and snippets.

@jeesim2
Created December 4, 2014 09:22
Show Gist options
  • Save jeesim2/8ddae34121bb1deddffc to your computer and use it in GitHub Desktop.
Save jeesim2/8ddae34121bb1deddffc to your computer and use it in GitHub Desktop.
따로 만들어서 테스트 하니 잘 되네 뭐가 문제일까.
1. 템플릿 추가
PUT /_template/template_test
{
"order": 0,
"template": "test-template-*",
"settings": {
"index.number_of_replicas": "1",
"index.number_of_shards": "5"
},
"mappings": {
"_default_": {
"dynamic_templates": [
{
"string_match": {
"mapping": {
"index": "not_analyzed",
"type": "string"
},
"match": "*",
"match_mapping_type": "string"
}
}
],
"_all": {
"enabled": false
}
}
},
"aliases": {}
}
2. 문서를 등록하며 타입까지 함께 생성
POST /test-template-index/mytype-a
{
"age": "19"
}
3. 타입의 맵핑확인
GET /test-template-index/_mapping/mytype-a
Response
{
"test-template-index": {
"mappings": {
"mytype-a": {
"dynamic_templates": [
{
"string_match": {
"mapping": {
"index": "not_analyzed",
"type": "string"
},
"match": "*",
"match_mapping_type": "string"
}
}
],
"_all": {
"enabled": false
},
"properties": {
"age": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}
4. 타입 삭제
DELETE /test-template-index/mytype-a
{
"acknowledged": true
}
5. 타입의 맵핑 확인
GET /test-template-index/_mapping/mytype-a
Response
{}
6. 형을 바꿔서 등록(long으로 되도록)
POST /test-template-index/mytype-a
{
"age": 19
}
7. 신규로 생성된 맵핑확인
GET /test-template-index/_mapping/mytype-a
Response
{
"test-template-index": {
"mappings": {
"mytype-a": {
"dynamic_templates": [
{
"string_match": {
"mapping": {
"index": "not_analyzed",
"type": "string"
},
"match": "*",
"match_mapping_type": "string"
}
}
],
"_all": {
"enabled": false
},
"properties": {
"age": {
"type": "long"
}
}
}
}
}
}
위와 같은 인련의 요청을 했을 때 문제 상황(리얼데이터로)은
118라인에서 age의 type이 여전히 string이었다는 것입니다.
5번에서 맵핑을 확인 했을 때 같은 결과로 아무것도 바노한을 안했는데도 말이지요.
이렇게 데이터 한 건으로 하니까 원하는 대로 잘 동작하는데
100만 건으로 테스트를 다시해봐야할지 음...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment