Hi there. I've been trying to use search_as_you_type for an autocomplete solution. I've mapped a field as the "search_as_you_type" type, however when trying to query on the field, the ._2gram and ._3gram field, as described in the documentation (Search-as-you-type field type | Elasticsearch Reference [7.12] | Elastic) I get an error:
{
"error" : {
"root_cause" : [
{
"type" : "query_shard_exception",
"reason" : "failed to create query: class org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper$SearchAsYouTypeAnalyzer cannot be cast to class org.elasticsearch.index.analysis.ReloadableCustomAnalyzer (org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper$SearchAsYouTypeAnalyzer is in unnamed module of loader java.net.FactoryURLClassLoader @60f21960; org.elasticsearch.index.analysis.ReloadableCustomAnalyzer is in unnamed module of loader 'app')",
"index_uuid" : "-B_u7gl-Qqaxumkt5v7D9Q",
"index" : "werkzaamheden_v3"
}
],
"type" : "search_phase_execution_exception",
"reason" : "all shards failed",
"phase" : "query",
"grouped" : true,
"failed_shards" : [
{
"shard" : 0,
"index" : "werkzaamheden_v3",
"node" : "FLpy4hJrRkWsc0lco0QteA",
"reason" : {
"type" : "query_shard_exception",
"reason" : "failed to create query: class org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper$SearchAsYouTypeAnalyzer cannot be cast to class org.elasticsearch.index.analysis.ReloadableCustomAnalyzer (org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper$SearchAsYouTypeAnalyzer is in unnamed module of loader java.net.FactoryURLClassLoader @60f21960; org.elasticsearch.index.analysis.ReloadableCustomAnalyzer is in unnamed module of loader 'app')",
"index_uuid" : "-B_u7gl-Qqaxumkt5v7D9Q",
"index" : "werkzaamheden_v3",
"caused_by" : {
"type" : "class_cast_exception",
"reason" : "class org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper$SearchAsYouTypeAnalyzer cannot be cast to class org.elasticsearch.index.analysis.ReloadableCustomAnalyzer (org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper$SearchAsYouTypeAnalyzer is in unnamed module of loader java.net.FactoryURLClassLoader @60f21960; org.elasticsearch.index.analysis.ReloadableCustomAnalyzer is in unnamed module of loader 'app')"
}
}
}
]
},
"status" : 400
}
This is the query:
GET werkzaamheden_v3/_search
{
"query": {
"multi_match": {
"query": "wass",
"type": "bool_prefix",
"fields": [
"omschrijving",
"omschrijving._2gram",
"omschrijving._3gram"
]
}
}
}
This is the part of the mapping that contains that field and the settings
"omschrijving": {
"type": "search_as_you_type",
"analyzer": "my_dutch_analyzer",
"search_analyzer": "my_search_analyzer"
},
"trefwoorden": {
"type": "text"
},
"urn": {
"type": "text"
}
}
},
"settings": {
"index": {
"routing": {
"allocation": {
"include": {
"_tier_preference": "data_content"
}
}
},
"number_of_shards": "1"
},
"analysis": {
"analyzer": {
"my_dutch_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"dutch_stemmer",
"dutch_stop"
]
},
"my_search_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"synonyms"
]
}
},
"filter": {
"dutch_stop": {
"type": "stop",
"stopwords": "_dutch_"
},
"dutch_stemmer": {
"type": "stemmer",
"language": "dutch"
},
"synonyms": {
"type": "synonym",
"synonyms_path": "analysis/synonym.txt",
"updateable": true
}
}
}
}
}
Does anyone have an idea of what is going wrong? This is in kibana, using elastic 7.11.1.