For my search I want to take into account the fact that the "space" character is not mandatory in a filter request.
For exemple:
when I filter on "THE ONE" I see the corresponding document.
I want to see it even if I write "THEONE".
This is how my query is built today:
boolQueryBuilder.must(QueryBuilders.boolQuery()
.should(QueryBuilders.wildcardQuery("description", "*" +
searchedWord.toLowerCase() + "*"))
.should(QueryBuilders.wildcardQuery("id", "*" +
searchedWord.toUpperCase() + "*"))
.should(QueryBuilders.wildcardQuery("label", "*" +
searchedWord.toUpperCase() + "*"))
.minimumShouldMatch("1"));
What I want is to add this filter: (Writing a space-ignoring autocompleter with ElasticSearch)
"word_joiner": {
"type": "word_delimiter",
"catenate_all": true
}
But I don't know how to do this using the API.
Any idea?
Thanks!
EDIT: Following @raam86 suggestion, I added my own custom analyzer:
{
"index": {
"number_of_shards": 1,
"analysis": {
"filter": {
"word_joiner": {
"type": "word_delimiter",
"catenate_all": true
}
},
"analyzer": {
"custom_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"word_joiner"
]
}
}
}
}
}
And here is the document:
@Document(indexName = "cake", type = "pa")
@Setting(settingPath = "/elasticsearch/config/settings.json")
public class PaElasticEntity implements Serializable {
@Field(type = FieldType.String, analyzer = "custom_analyzer")
private String maker;
}
Still not working...