I have a problem sorting my searches correctly by using norwegian collation.
I've installed the
https://github.com/elasticsearch/elasticsearch-analysis-icu plugin, and
I've created my index with the following properties.
Java:
.startObject("analysis")
.startObject("analyzer")
.startObject("collation")
.field("tokenizer", "keyword")
.field("filter", "norwegianCollator")
.endObject()
.endObject()
.startObject("filter")
.startObject("norwegianCollator")
.field("type", "icu_collation")
.field("language", "norwegian")
.endObject()
.endObject()
.endObject()
JSON:
{
"index": {
"analysis": {
"analyzer": {
"collation": {
"tokenizer": "keyword",
"filter": "norwegianCollator"
}
},
"filter": {
"norwegianCollator": {
"type": "icu_collation",
"language": "nb"
}
}
}
}
}
Elasticsearch Head show this as:
settings: {
- index.analysis.analyzer.default.filter: norwegianCollator
- index.analysis.filter.norwegianCollator.type: icu_collation
- index.analysis.analyzer.collation.tokenizer: keyword
- index.analysis.filter.norwegianCollator.language: norwegian
}
Is this correctly configured?
For search I'm doing this:
QueryBuilder qb = QueryBuilders.matchQuery(
"customer.partner",
"1"
);
SearchResponse response =
this.esClient.prepareSearch(this.client.getName())
.setTypes("customer")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(qb)
.setFrom(0).setSize(size)
.addSort("name", SortOrder.DESC)
.execute()
.actionGet();
But the result I get is:
DEBUG 15:21:00 search.ESSearch - {enabled=true, name=ølen fiskelag,
partner=1}
DEBUG 15:21:00 search.ESSearch - {enabled=true, name=æ vil ha dæ, partner=1}
DEBUG 15:21:00 search.ESSearch - {enabled=true, name=åges plateselskap as,
partner=1}
DEBUG 15:21:00 search.ESSearch - {enabled=true, name=yara international,
partner=1}
When it should be:
DEBUG 15:21:00 search.ESSearch - {enabled=true, name=åges plateselskap as,
partner=1}
DEBUG 15:21:00 search.ESSearch - {enabled=true, name=ølen fiskelag,
partner=1}
DEBUG 15:21:00 search.ESSearch - {enabled=true, name=æ vil ha dæ, partner=1}
DEBUG 15:21:00 search.ESSearch - {enabled=true, name=yara international,
partner=1}
What am I doing wrong? What could be missing in my configuration?
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.