Skip to content

Instantly share code, notes, and snippets.

@marklin-latte
Last active August 29, 2015 14:09
Show Gist options
  • Save marklin-latte/182febfb7e177a08c290 to your computer and use it in GitHub Desktop.
Save marklin-latte/182febfb7e177a08c290 to your computer and use it in GitHub Desktop.
ElasticSearch-CreaetParentChildMapping
//Create Parent mapping
Uri:Put
http://localhost:9200/test1/_mapping/content
Json:
{
"content" : {
"properties" : {
"file" : {
"type" : "attachment",
"fields" : {
"title" : { "store" : "yes" },
"file" : { "term_vector":"with_positions_offsets", "store":"yes" }
}
},
"name":{"type":"string"},
"Id":{"type":"string"}
}
}
}
//Create Child mapping
Uri:Put
http://localhost:9200/test1/_mapping/document
Json
{
"document": {
"dynamic" : "false",
"_parent": {
"type": "content"
},
"_all": {
"enabled": "false"
},
"_id": {
"index": "not_analyzed",
"store": "yes"
},
"properties": {
"ProjectId": {
"type": "long",
"store": "no",
"index": "not_analyzed"
},
"OrganizationId": {
"type": "long",
"store": "no",
"index": "not_analyzed"
},
"DocumentId": {
"type": "string",
"store": "yes",
"index": "not_analyzed"
},
"Title": {
"type": "string",
"store": "yes",
"index": "analyzed"
},
"Confidential": {
"type": "long",
"store": "no",
"index": "not_analyzed"
},
"Author": {
"type": "long",
"store": "no",
"index": "not_analyzed"
},
"CreateTime": {
"type": "date",
"store": "no",
"index": "not_analyzed"
},
"InTemp": {
"type": "boolean",
"store": "no",
"index": "not_analyzed"
},
"FileExtension": {
"type": "boolean",
"store": "no",
"index": "not_analyzed"
},
"VersionCustom": {
"type": "boolean",
"store": "no",
"index": "not_analyzed"
},
"LatestVersion": {
"type": "boolean",
"store": "no",
"index": "not_analyzed"
},
"單選欄位": {
"type": "long",
"store": "no",
"index": "not_analyzed"
},
"多選欄位": {
"type": "long",
"store": "no",
"index": "not_analyzed"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment