У меня есть проект на Spring dataasticSearch. Модель:
@Document(indexName = "house", createIndex = false)
public class House {
@Id
private String id;
private String aoGuid;
private String buildNum;
private String houseGuid;
private String houseId;
private String houseNum;
private String postalCode;
private String regionCode;
}
Репозиторий:
@Query("{\n" +
" \"bool\": {\n" +
" \"must\": [\n" +
" {\n" +
" \"bool\": {\n" +
" \"must\": [\n" +
" {\n" +
" \"terms\": {\n" +
" \"aoGuid\": \"[?0]\"\n" +
" }\n" +
" }\n" +
" ]\n" +
" }\n" +
" }\n" +
" ]\n" +
" }\n" +
"}")
List<House> findByAoGuidIn(Collection<String> aoGuid);
Мой индекс в Elasti c:
{
"house": {
"aliases": {},
"mappings": {
"properties": {
"_class": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"aoGuid": {
"type": "keyword"
},
"buildNum": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"houseGuid": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"houseId": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"houseNum": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"postalCode": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"regionCode": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
"settings": {
"index": {
"search": {
"slowlog": {
"threshold": {
"query": {
"info": "1ms"
}
}
}
},
"number_of_shards": "1",
"provided_name": "house",
"creation_date": "1582210642568",
"number_of_replicas": "1",
"uuid": "c43T1LthTH6LhTphjZ-Ulw",
"version": {
"created": "7040099"
}
}
}
}
}
Когда я вызываю метод findByAoGuidIn, я получить сообщение об ошибке:
org.elasticsearch.ElasticsearchStatusException: Исключение Elasticsearch [тип = parsing_exception, причина = [термины] запрос не поддерживает [aoGuid]] в org.elasticsearch. rest.BytesRestResponse.errorFromXContent (BytesRestResponse. java: 177) ~ [asticsearch-7.4.0.jar: 7.4.0] в org.elasticsearch.client.RestHighLevelClient.parseEntity (RestHighLevelClise. -rest-high-level-client-7.4.0.jar: 7.4.0] at org.elasticsearch.client.RestHighLevelClient.parseResponseException (RestHighLevelClient. java: 1704) ~ [asticsearch-rest-high-level-client- 7.4.0.jar: 7.4.0] at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest (RestHighLevelClient. java: 1467) ~ [asticsearch-rest-high-level-client-7.4.0.jar: 7.4.0 ] at org.elasticsearch.client.RestHighLevelClient.performRequest ( RestHighLevelClient. java: 1424) ~ [asticsearch-rest-high-level-client-7.4.0.jar: 7.4.0] в org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity (RestHighLevelClient. * ~ 1030 *: [asticsearch-rest-high-level-client-7.4.0.jar: 7.4.0]
Я получил запрос из документации по этой ссылке: https://docs.spring.io/spring-data/elasticsearch/docs/4.0.x/reference/html/#elasticsearch .query- методы
Как я могу исправить ошибку?