타입을 정할수있다.
String이 6.x부터는 text로변경되었다.
{
"class" : {
"properties" : {
"title" : {"type" : "text"},
"professor" : { "type" : "text"},
"major" : {"type" : "text"},
"semester" : {"type" : "text" },
"student_count" : {"type" : "integer"},
"unit" : {"type" : "integer"},
"submit_date" : {"type" : "date","format" : "yyyy-MM-dd"},
"school_location" : {"type" : "geo_point"}
}
}
}
{
"classes" : {
"aliases" : { },
"mappings" : {
"class" : {
"properties" : {
"major" : {
"type" : "text"
},
"professor" : {
"type" : "text"
},
"school_location" : {
"type" : "geo_point"
},
"semester" : {
"type" : "text"
},
"student_count" : {
"type" : "integer"
},
"submit_date" : {
"type" : "date",
"format" : "yyyy-MM-dd"
},
"title" : {
"type" : "text"
},
"unit" : {
"type" : "integer"
}
}
}
},
"settings" : {
"index" : {
"creation_date" : "1519968181208",
"number_of_shards" : "5",
"number_of_replicas" : "1",
"uuid" : "bc-lXSbRTdO88MARZ8qvDQ",
"version" : {
"created" : "6020299"
},
"provided_name" : "classes"
}
}
}
}
그후에 데이터를 넣어보면
요렇게 나온다
[js@localhost elasticsearch]$ curl -XGET http://localhost:9200/classes/class/1/?pretty
{
"_index" : "classes",
"_type" : "class",
"_id" : "1",
"_version" : 1,
"found" : true,
"_source" : {
"title" : "Machine Learning",
"Professor" : "Minsuk Heo",
"major" : "Computer Science",
"semester" : [
"spring",
"fall"
],
"student_count" : 100,
"unit" : 3,
"rating" : 5,
"submit_date" : "2016-01-02",
"school_location" : {
"lat" : 36.0,
"lon" : -120.0
}
}
}
'오락기 > ELK' 카테고리의 다른 글
elasticsearch aggregation (0) | 2018.05.11 |
---|---|
elasticsearch search (0) | 2018.05.11 |
elasticsearch bulk (0) | 2018.05.11 |
elasticsearch update (0) | 2018.05.11 |
elasticsearch put / delete / post (0) | 2018.05.11 |