Автозаполнение не работает с использованием spring-data -asticsearch с использованием @ Query
Информация о версии: Elasticsearc: 6.3.0, spring-data -asticsearch: 3.0.5.RELEASE и spring-boot 2.x.release
Создан индекс в ES 6.3.0, как указано ниже
{
"settings": {
"index": {
"analysis": {
"filter": {},
"analyzer": {
"keyword_analyzer": {
"filter": [
"lowercase",
"asciifolding",
"trim"
],
"char_filter": [],
"type": "custom",
"tokenizer": "keyword"
},
"edge_ngram_analyzer": {
"filter": [
"lowercase"
],
"tokenizer": "edge_ngram_tokenizer"
},
"edge_ngram_search_analyzer": {
"tokenizer": "lowercase"
}
},
"tokenizer": {
"edge_ngram_tokenizer": {
"type": "edge_ngram",
"min_gram": 2,
"max_gram": 5,
"token_chars": [
"letter"
]
}
}
}
}
},
"mappings": {
"sometype": {
"properties": {
"rs": {
"type": "text",
"fields": {
"keywordstring": {
"type": "text",
"analyzer": "keyword_analyzer"
},
"edgengram": {
"type": "text",
"analyzer": "edge_ngram_analyzer",
"search_analyzer": "edge_ngram_search_analyzer"
},
"completion": {
"type": "completion"
}
},
"analyzer": "standard"
},
"tl1": {
"type": "text"
},
"tl2": {
"type": "text"
},
"tl3": {
"type": "text"
},
"tl4": {
"type": "text"
}
}
}
}
}
Ниже приведен код объекта,
@Document(indexName = "someindex", type = "sometype")
public class ContentEntity {
@CompletionField()
private String rs;
private String tl2;
private String tl3;
private String tl4;
@Id
private String tl1;
Ниже приведен пользовательский запрос в классе репозитория
@Repository
public interface ContentRepository extends ElasticsearchRepository<ContentEntity, String> {
@Query("{ \"suggest\": { \"content-suggest\" : { \"prefix\" : \"?0\", \"completion\" : { \"field\" : \"rs.completion\" }}}}")
List<ContentEntity> getSuggestions(String ts);
}
Когда я запускаю API для авто-предложений, появляется ошибка ниже
org.elasticsearch.common.ParsingException: no [query] registered for [suggest]
at org.elasticsearch.index.query.AbstractQueryBuilder.parseInnerQueryBuilder (AbstractQueryBuilder.java:322) ~[elasticsearch-5.6.8.jar:5.6.8]
at org.elasticsearch.index.query.WrapperQueryBuilder.doRewrite(WrapperQueryBuilder.java:165) ~[elasticsearch-5.6.8.jar:5.6.8]
at org.elasticsearch.index.query.AbstractQueryBuilder.rewrite(AbstractQueryBuilder.java:269) ~[elasticsearch-5.6.8.jar:5.6.8]
at org.elasticsearch.search.builder.SearchSourceBuilder.rewrite(SearchSourceBuilder.java:888) ~[elasticsearch-5.6.8.jar:5.6.8]
at org.elasticsearch.search.builder.SearchSourceBuilder.rewrite(SearchSourceBuilder.java:79) ~[elasticsearch-5.6.8.jar:5.6.8]
База кода предоставлена @ https://github.com/VenkataMR/ElasticsearchWithAutosuggestion
Есть проблемы с кодом?Просьба предложить.