4,563,305 th visitor since 2017.2.1 ( Today : 199 )
Programming
No. 700
Name. swindler
Subject. [ElasticSearch] Mapping 생성
Main Cate. 기타 DB
Sub Cate.
Date. 2013-03-18 14:15
Hit. 3002 (211.36.27.3)
File.
Mapping 생성

curl -XPUT 'http://localhost:9200/neisar/message/_mapping' -d '
{
"message" : {
"properties" : {
"create_at" : {
"type" : "date",
"format" : "dateOptionalTime"
},
"message" : {
"type" : "string"
},
"receiver" : {
"type" : "string"
},
"user" : {
"type" : "string"
}
}
}
}
'


Mapping 삭제
curl -XDELETE 'http://localhost:9200/neisar/message'


Mapping 에 필드 추가

curl -XPUT 'http://localhost:9200/neisar/message/_mapping' -d '
{
"message" : {
"properties" : {
"messageType" : {
"type" : "string"
}
}
}
}
'
기존에 필드가 있는 경우 type을 바꾸면 에러가 발생한다.
{"error":"MergeMappingException[Merge failed with failures {[mapper [messageType] of different type, current_type [date], merged_type [string]]}]","status":400


[바로가기 링크] : http://coolx.net/cboard/develop/700



Name
Password
Comment
Copyright © 1999-2017, swindler. All rights reserved. 367,611 visitor ( 1999.1.8-2004.5.26 ), 2,405,771 ( -2017.01.31)

  2HLAB   2HLAB_Blog   RedToolBox   Omil   Omil_Blog