Skip to content

Instantly share code, notes, and snippets.

@ephemeralsnow
Created December 12, 2014 06:09
Show Gist options
  • Save ephemeralsnow/b1369b037932b96f105b to your computer and use it in GitHub Desktop.
Save ephemeralsnow/b1369b037932b96f105b to your computer and use it in GitHub Desktop.
Elasticsearch Advent Calendar 2014 16日目
{
"template": "message_index",
"settings": {
"index": {
"number_of_shards": 10,
"number_of_replicas": 0,
"analysis": {
"analyzer": {
"message_analyzer": {
"type": "custom",
"tokenizer": "message_ngram_tokenizer",
"filter": [],
"char_filter": [ "html_strip" ]
}
},
"tokenizer": {
"message_ngram_tokenizer": {
"type": "ngram",
"min_gram": 1,
"max_gram": 2,
"token_chars": [ "letter", "digit", "punctuation", "symbol" ]
}
}
}
}
},
"mappings": {
"_default_": {
"_source": { "enabled": false },
"_all": { "enabled": false },
"properties": {
"message_id": { "type": "long" },
"message_comment_id": { "type": "long" },
"user_id": { "type": "long" },
"message": { "type": "string" },
"created_at": { "type": "date" },
"updated_at": { "type": "date" }
}
},
"messages": {
"_id": { "path": "message_id" },
"properties": {
"message_id": { "type": "long" },
"network_id": { "type": "long" },
"user_id": { "type": "long" },
"message": { "type": "string", "analyzer": "message_analyzer" },
"created_at": { "type": "date" }
}
},
"message_comments": {
"_id": { "path": "message_comment_id" },
"_parent": { "type": "messages" },
"properties": {
"message_comment_id": { "type": "long" },
"message_id": { "type": "long" },
"network_id": { "type": "long" },
"user_id": { "type": "long" },
"message": { "type": "string", "analyzer": "message_analyzer" },
"created_at": { "type": "date" }
}
},
"deleted_messages": {
"_id": { "path": "message_id" },
"_parent": { "type": "messages" },
"properties": {
"message_id": { "type": "long" },
"created_at": { "type": "date" }
}
},
"deleted_message_comments": {
"_id": { "path": "message_comment_id" },
"_parent": { "type": "message_comments" },
"properties": {
"message_comment_id": { "type": "long" },
"created_at": { "type": "date" }
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment