Skip to content

Instantly share code, notes, and snippets.

@lfreneda
Last active August 31, 2015 14:03
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 lfreneda/74bfc68439144899d256 to your computer and use it in GitHub Desktop.
Save lfreneda/74bfc68439144899d256 to your computer and use it in GitHub Desktop.
index_people_with_routing
# Delete the `people` index
DELETE /people
# Create the `people` index with proper settings
PUT /people
{
"settings": {
"analysis": {
"filter": {
"brazilian_stop": {
"type": "stop",
"stopwords": "_brazilian_"
},
"brazilian_stemmer": {
"type": "stemmer",
"language": "brazilian"
}
},
"analyzer": {
"brazilian": {
"tokenizer": "standard",
"filter": [
"lowercase",
"brazilian_stop",
"brazilian_stemmer"
]
}
}
}
},
"mappings": {
"person": {
"_routing": {
"required": true,
"path": "accountId"
},
"properties": {
"accountId": {
"type": "string",
"index" : "not_analyzed"
},
"imageUrl": {
"type": "string",
"index" : "not_analyzed"
},
"title": {
"type": "string",
"index" : "not_analyzed"
},
"createdAt": {
"type": "date",
"index" : "not_analyzed"
},
"firstName": {
"type": "multi_field",
"fields": {
"firstName": {
"type": "string",
"analyzer":"brazilian"
},
"untouched": {
"type": "string",
"index" : "not_analyzed"
}
}
},
"lastName": {
"type": "multi_field",
"fields": {
"lastName": {
"type": "string",
"analyzer":"brazilian"
},
"untouched": {
"type": "string",
"index" : "not_analyzed"
}
}
},
"tags": {
"type": "string"
},
"emails":{
"type": "multi_field",
"fields": {
"email": {
"type": "string",
"index" : "analyzed",
"analyzer": "simple"
},
"untouched":{
"type": "string",
"index" : "not_analyzed"
}
}
},
"phones":{
"type": "multi_field",
"fields": {
"phones": {
"type": "string",
"index" : "analyzed",
"analyzer": "whitespace"
},
"untouched":{
"type": "string",
"index" : "not_analyzed"
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment