Skip to content

Instantly share code, notes, and snippets.

@jprante
Created August 3, 2012 23:06
Show Gist options
  • Save jprante/3252443 to your computer and use it in GitHub Desktop.
Save jprante/3252443 to your computer and use it in GitHub Desktop.
ICU folding tokenizer filter in action
curl -XDELETE 'http://localhost:9200/test/'
curl -XPOST 'http://localhost:9200/test' -d '{
"settings" : {
"index" : {
"analysis" : {
"analyzer" : {
"icu" : {
"type" : "custom",
"tokenizer" : "icu_tokenizer",
"filter" : [ "icu_folding" ]
}
}
}
}
},
"mappings" : {
"_default_" : {
"properties" : {
"name" : {
"type" : "string",
"analyzer" : "icu"
}
}
}
}
}'
curl -XPUT 'http://localhost:9200/test/names/1' -d '{
"name" : "Gearóid"
}'
curl -XPUT 'http://localhost:9200/test/names/2' -d '{
"name" : "Raphaël"
}'
curl -XPUT 'http://localhost:9200/test/names/3' -d '{
"name" : "Éva"
}'
curl -XPUT 'http://localhost:9200/test/names/4' -d '{
"name" : "Häberle"
}'
curl -XPOST 'http://localhost:9200/test/_refresh'
echo
curl -XGET 'http://localhost:9200/test/_search?pretty' -d '{
"query": {
"text" : {
"name": "Gearóid"
}
}
}'
echo
curl -XGET 'http://localhost:9200/test/_search?pretty' -d '{
"query": {
"text" : {
"name": "Raphaël"
}
}
}'
echo
curl -XGET 'http://localhost:9200/test/_search?pretty' -d '{
"query": {
"text" : {
"name": "Éva"
}
}
}'
echo
curl -XGET 'http://localhost:9200/test/_search?pretty' -d '{
"query": {
"text" : {
"name": "Häberle"
}
}
}'
echo
curl -XGET 'http://localhost:9200/test/_search?pretty' -d '{
"query": {
"text" : {
"name": "Gearoid"
}
}
}'
echo
curl -XGET 'http://localhost:9200/test/_search?pretty' -d '{
"query": {
"text" : {
"name": "Raphael"
}
}
}'
echo
curl -XGET 'http://localhost:9200/test/_search?pretty' -d '{
"query": {
"text" : {
"name": "Eva"
}
}
}'
echo
curl -XGET 'http://localhost:9200/test/_search?pretty' -d '{
"query": {
"text" : {
"name": "Haberle"
}
}
}'
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment