Skip to content

Instantly share code, notes, and snippets.

@jinleileiking
Created November 3, 2015 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jinleileiking/a8beaf2f3371399ac6a3 to your computer and use it in GitHub Desktop.
Save jinleileiking/a8beaf2f3371399ac6a3 to your computer and use it in GitHub Desktop.
curl -XPUT localhost:8200/_template/template_1 -d '
{
"template" : "history",
"settings" : {
"analysis" : {
"analyzer" : {
"pinyin_analyzer" : {
"tokenizer" : "my_pinyin",
"filter" : ["word_delimiter","nGram"]
}
},
"tokenizer" : {
"my_pinyin" : {
"type" : "pinyin",
"first_letter" : "prefix",
"padding_char" : " "
}
}
}
},
"mappings": {
"user1": {
"properties": {
"history_content" : { "type" : "string", "copy_to" : "history_content_py" },
"history_content_py": {
"type": "string",
"store": "no",
"term_vector": "with_positions_offsets",
"analyzer": "pinyin_analyzer",
"boost": 10
}
}
}
}
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment