Skip to content

Instantly share code, notes, and snippets.

@santiagobasulto
Created March 30, 2012 15:05
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 santiagobasulto/2252157 to your computer and use it in GitHub Desktop.
Save santiagobasulto/2252157 to your computer and use it in GitHub Desktop.
User Mapping
curl -XPUT 'http://127.0.0.1:9200/test_index/?pretty=1' -d '
{
"mappings" : {
"user" : {
"properties" : {
"user_id" : {
"type" : "string",
"analyzer" : "simple"
},
"last_name" : {
"fields" : {
"partial" : {
"search_analyzer" : "full_name",
"index_analyzer" : "partial_name",
"type" : "string"
},
"last_name" : {
"type" : "string",
"analyzer" : "full_name"
}
},
"type" : "multi_field"
},
"first_name" : {
"fields" : {
"partial" : {
"search_analyzer" : "full_name",
"index_analyzer" : "partial_name",
"type" : "string"
},
"first_name" : {
"type" : "string",
"analyzer" : "full_name"
}
},
"type" : "multi_field"
}
}
}
},
"settings" : {
"analysis" : {
"filter" : {
"name_ngrams" : {
"side" : "front",
"max_gram" : 10,
"min_gram" : 1,
"type" : "edgeNGram"
}
},
"analyzer" : {
"full_name" : {
"filter" : [
"standard",
"lowercase",
"asciifolding"
],
"type" : "custom",
"tokenizer" : "standard"
},
"partial_name" : {
"filter" : [
"standard",
"lowercase",
"asciifolding",
"name_ngrams"
],
"type" : "custom",
"tokenizer" : "standard"
}
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment