Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chokkoyamada/512c1e0af97aea023e42fb0e4b41ee2d to your computer and use it in GitHub Desktop.
Save chokkoyamada/512c1e0af97aea023e42fb0e4b41ee2d to your computer and use it in GitHub Desktop.
Elasticsearch template
PUT /_template/sample
{
"template": "sample*",
"settings": {
"analysis" : {
"analyzer" : {
"ja-ma-analyzer" : {
"type" : "custom",
"tokenizer" : "ja-ma-tokenizer"
},
"ja-1gram-analyzer" : {
"type" : "custom",
"tokenizer" : "ja-1gram-tokenizer"
}
},
"tokenizer": {
"ja-ma-tokenizer": {
"type": "kuromoji_tokenizer",
"mode": "normal"
},
"ja-1gram-tokenizer": {
"type" : "nGram",
"min_gram" : "1",
"max_gram" : "3"
}
}
}
},
"mappings": {
"_default_" : {
"dynamic_templates" : [
{
"sample_text_for_ma" : {
"match" : "text-ja-ma",
"mapping" : {
"type" : "text",
"store": "true",
"analyzer" : "ja-ma-analyzer"
}
}
},
{
"sample_text_for_1gram" : {
"match" : "text-ja-1gram",
"mapping" : {
"type" : "text",
"store" : "true",
"analyzer" : "ja-1gram-analyzer"
}
}
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment