Skip to content

Instantly share code, notes, and snippets.

@tzmfreedom
Last active March 12, 2016 13:50
Show Gist options
  • Save tzmfreedom/134fdfd7228fe49d93d1 to your computer and use it in GitHub Desktop.
Save tzmfreedom/134fdfd7228fe49d93d1 to your computer and use it in GitHub Desktop.
curl -X POST http://localhost:9200/_template/template_idle -H "Content-type: application/json" -d '{
"template" : "logstash-*",
"settings": {
"analysis": {
"filter": {
"pos_filter": {
"type": "kuromoji_part_of_speech",
"stoptags": ["接続詞", "助動詞", "助詞", "助詞-格助詞", "助詞-格助詞-一般", "助詞-格助詞-引用", "助詞-格助詞-連語", "助詞-接続助詞", "助詞-係助詞", "助詞-副助詞", "助詞-間投助詞", "助詞-並立助詞", "助詞-終助詞", "助詞-副助詞/並立助詞/終助詞", "助詞-連体化", "助詞-副詞化", "助詞-特殊"]
}
},
"tokenizer": {
"ja_tokenizer": {
"type": "kuromoji_tokenizer",
"mode": "search",
"user_dictionary": "userdict_ja.txt"
}
},
"analyzer": {
"ja_analyzer": {
"type": "custom",
"tokenizer": "ja_tokenizer",
"filter": ["pos_filter"]
}
}
}
},
"mappings": {
"idle": { // type name
"dynamic_templates": [
{
"string_template": { //任意の名前。上から順に評価される。
"mapping": {
"index": "analyzed", // analyzed or not_analyzed
"type": "string"
},
"match_mapping_type": "string", // dynamic field mapping type(string)
"match": "text" // match string
}
},
{
"string_template": {
"mapping": {
"index": "not_analyzed",
"type": "string"
},
"match_mapping_type": "string",
"match": "*"
}
}
],
"properties": { // static properties
"created_at": { // property name
"type": "date", // data type
"format": "EEE MMM dd HH:mm:ss Z yyyy" // format for date
},
"timestamp_ms": {
"type": "date",
"format": "epoch_millis"
}
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment