Skip to content

Instantly share code, notes, and snippets.

@matthewarkin
Forked from clintongormley/gist:1088986
Last active December 23, 2015 07:39
Show Gist options
  • Save matthewarkin/6602114 to your computer and use it in GitHub Desktop.
Save matthewarkin/6602114 to your computer and use it in GitHub Desktop.
## CREATE THE INDEX WITH ANALYZERS AND MAPPINGS
curl -XPUT 'http://127.0.0.1:9200/eshtml/?pretty=1' -d '
{
"mappings" : {
"page" : {
"dynamic":false,
"properties" : {
"title" : {
"fields" : {
"metaphone" : {
"type" : "string",
"analyzer" : "title_metaphone"
},
"partial" : {
"search_analyzer" : "full_title",
"index_analyzer" : "partial_title",
"type" : "string"
},
"title" : {
"type" : "string",
"analyzer" : "full_title"
}
},
"type" : "multi_field"
}
}
}
},
"settings" : {
"analysis" : {
"filter" : {
"title_ngrams" : {
"side" : "front",
"max_gram" : 10,
"min_gram" : 1,
"type" : "edgeNGram"
},
"title_metaphone" : {
"replace" : false,
"encoder" : "metaphone",
"type" : "phonetic"
}
},
"analyzer" : {
"full_title" : {
"filter" : [
"standard",
"lowercase",
"asciifolding"
],
"type" : "custom",
"tokenizer" : "standard"
},
"title_metaphone" : {
"filter" : [
"title_metaphone"
],
"type" : "custom",
"tokenizer" : "standard"
},
"partial_title" : {
"filter" : [
"standard",
"lowercase",
"asciifolding",
"title_ngrams"
],
"type" : "custom",
"tokenizer" : "standard"
}
}
}
}
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment