Skip to content

Instantly share code, notes, and snippets.

@marklin-latte
Created November 18, 2014 06:35
Show Gist options
  • Save marklin-latte/eb68f321de4283293530 to your computer and use it in GitHub Desktop.
Save marklin-latte/eb68f321de4283293530 to your computer and use it in GitHub Desktop.
ElasticSearch-CRUD Multifields Type
//Create Mapping
Uri : PUT
localhost:9200/test1/_mapping/testtype
(test1 is index)
(testtype is typename)
Json:
{
"testtype" : {
"properties" : {
"name":{
"type" : "string" ,
"fields":{
"facet": { "type" : "string", "index": "not_analyzed" }
}
}
}
}
}
Result:
{
"acknowledged": true
}
==========================================================================================================================================
//Read Mapping
Uri: GET
localhost:9200/test1/_mapping/testtype
Result:
{
"test1": {
"mappings": {
"testtype": {
"properties": {
"name": {
"type": "string",
"fields": {
"facet": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}
}
}
==========================================================================================================================================
//Update
It is same Create step.
==========================================================================================================================================
//Delete
Uri:DELETE
localhost:9200/test1/_mapping/testtype
Result:
{
"acknowledged": true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment