Created
November 18, 2014 06:35
-
-
Save marklin-latte/eb68f321de4283293530 to your computer and use it in GitHub Desktop.
ElasticSearch-CRUD Multifields Type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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