Skip to content

Instantly share code, notes, and snippets.

@kimchy
Created February 7, 2012 11:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kimchy/1759303 to your computer and use it in GitHub Desktop.
Save kimchy/1759303 to your computer and use it in GitHub Desktop.
curl -XPUT localhost:9200/test -d '
{
"settings" : {
"index": {
"analysis": {
"analyzer": {
"manualindexanalyzer": {
"type": "custom",
"tokenizer": "whitespace",
"filter": [
"lowercase",
"asciifolding",
"length",
"myelision"
],
"char_filter": [
"html_strip"
]
},
"manualsearchanalyzer": {
"type": "custom",
"tokenizer": "whitespace",
"filter": [
"lowercase",
"asciifolding",
"length",
"myelision"
],
"char_filter": [
"html_strip"
]
}
},
"filter": {
"myelision": {
"type": "elision",
"articles": ["l", "m", "t", "qu", "n", "s", "j"]
}
}
}
}
},
"mappings" : {
"my_type" : {
"index_analyzer" : "manualindexanalyzer",
"search_analyzer" : "manualsearchanalyzer"
}
}
}'
curl localhost:9200/test/_analyze?analyzer=manualindexanalyzer -d 'l’avion'
curl localhost:9200/test/my_type/1 -d '{
"my_field" : "l’avion"
}'
curl -XPOST localhost:9200/test/_refresh
# With my_type in search
curl localhost:9200/test/my_type/_search?pretty=1 -d '{
"query" : {
"query_string" : {
"query" : "l’avion"
}
}
}'
# Without my_type in search
curl localhost:9200/test/my_type/_search?pretty=1 -d '{
"query" : {
"query_string" : {
"default_field" : "my_field",
"query" : "l’avion"
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment