Skip to content

Instantly share code, notes, and snippets.

@crx
Created May 15, 2011 04:00
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 crx/972878 to your computer and use it in GitHub Desktop.
Save crx/972878 to your computer and use it in GitHub Desktop.
asciifolding behavior in ElasticSearch
# config/elasticsearch.yml
index:
analysis:
analyzer:
default:
tokenizer: standard
filter: ["standard", "lowercase", "stop", "asciifolding"]
curl -XPUT localhost:9200/test
# {"ok":true,"acknowledged":true}
curl -XPUT localhost:9200/test/person/1 -d '{"name":"Cameron Díaz"}'
# {"ok":true,"_index":"test","_type":"person","_id":"1","_version":1}
curl -XPUT localhost:9200/test/person/2 -d '{"name":"Juan Diaz"}'
# {"ok":true,"_index":"test","_type":"person","_id":"2","_version":1}
curl -XGET "localhost:9200/test/person/_search?q=diaz&pretty"
# {
# ... omitted ...
#
# "hits" : {
# "total" : 2,
# "max_score" : 0.13561106,
# "hits" : [ {
# "_index" : "test",
# "_type" : "person",
# "_id" : "1",
# "_score" : 0.13561106, "_source" : {"name":"Cameron Díaz"}
# }, {
# "_index" : "test",
# "_type" : "person",
# "_id" : "2",
# "_score" : 0.13561106, "_source" : {"name":"Juan Diaz"}
# } ]
# }
# }
curl -XGET "localhost:9200/test/person/_search?q=díaz&pretty"
# {
# ... omitted ...
#
# "hits" : {
# "total" : 0,
# "max_score" : null,
# "hits" : [ ]
# }
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment