Last active
December 18, 2015 21:19
-
-
Save lukas-vlcek/5846552 to your computer and use it in GitHub Desktop.
Ukázka ICU Collation pro češtinu.
Předpokládá Elasticsearch 0.90.0 a nainstalovaný ICU plugin 1.9.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
curl -X DELETE 'localhost:9200/i/' | |
curl -X POST 'localhost:9200/i/' -d '{ | |
"settings" : { | |
"number_of_shards" : 1, | |
"number_of_replicas" : 0, | |
"analysis" : { | |
"analyzer" : { | |
"cs_icu_analyzer" : { | |
"type" : "custom", | |
"tokenizer" : "standard", | |
"filter" : ["cs_icu_collation"] | |
} | |
}, | |
"filter" : { | |
"cs_icu_collation" : { | |
"type" : "icu_collation", | |
"language" : "cs" | |
} | |
} | |
} | |
}, | |
"mappings" : { | |
"t" : { | |
"properties" : { | |
"text_icu" : { "type" : "string", "analyzer" : "cs_icu_analyzer" }, | |
"text" : { "type" : "string" } | |
} | |
} | |
} | |
}' | |
curl -X POST 'localhost:9200/i/t/' -d '{ "text_icu" : "Celer", "text" : "Celer" }' | |
curl -X POST 'localhost:9200/i/t/' -d '{ "text_icu" : "Cypřiš", "text" : "Cypřiš" }' | |
curl -X POST 'localhost:9200/i/t/' -d '{ "text_icu" : "Cizrna", "text" : "Cizrna" }' | |
curl -X POST 'localhost:9200/i/t/' -d '{ "text_icu" : "Chřest", "text" : "Chřest" }' | |
curl -X POST 'localhost:9200/i/_refresh' | |
echo | |
echo; echo "Non ICU" | |
curl -X GET 'localhost:9200/i/t/_search?pretty=true' -d '{ | |
"query" : { "match_all" : {} }, | |
"sort" : [ "text" ] | |
}' | |
echo; echo "ICU" | |
curl -X GET 'localhost:9200/i/t/_search?pretty=true' -d '{ | |
"query" : { "match_all" : {} }, | |
"sort" : [ "text_icu" ] | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment