У меня есть проект на Spring dataasticSearch. Модель:
@Document(indexName = "address", createIndex = true)
public class Address {
@Id
private String id;
@Field(type = FieldType.Text )
private String fullAddress;
private String regionCode;
@Field(type = FieldType.Nested, store = true)
private List<Entry> parts;
public Address(String fullAddress) {
this.fullAddress = fullAddress;
}
public Address(String fullAddress, List<Entry> entryList) {
this.fullAddress = fullAddress;
this.parts = entryList;
}
public Address(String fullAddress, List<Entry> entryList, String regionCode) {
this.fullAddress = fullAddress;
this.parts = entryList;
this.regionCode = regionCode;
}
}
Репозиторий (fullAddress == "* Россия Москва *"; без @Query метод не работает с ключом, содержащим пробел)
@Repository
public interface AddressElasticRepository extends ElasticsearchRepository<Address, String> {
@Query("{\"bool\" : {\"must\" : {\"field\" : {\"fullAddress\" : {\"query\" : \"?\",\"analyze_wildcard\" : true}}}}}")
List<Address> findByFullAddressLike(String fullAddress);
}
Мой индекс в Elasti c:
{
"address": {
"aliases": {},
"mappings": {
"properties": {
"fullAddress": {
"type": "text"
},
"parts": {
"type": "nested",
"properties": {
"aoGuid": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"aoLevel": {
"type": "integer"
},
"aoid": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"code": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"offName": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"parentGuid": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"postalCode": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"shortName": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
"regionCode": {
"type": "integer"
}
}
},
"settings": {
"index": {
"refresh_interval": "1s",
"number_of_shards": "1",
"provided_name": "address",
"creation_date": "1582120325272",
"store": {
"type": "fs"
},
"number_of_replicas": "1",
"uuid": "CG3m-SDdT9CqpXXJ2knl4g",
"version": {
"created": "7040099"
}
}
}
}
}
Когда я вызываю метод findByFullAddressLike, я получаю сообщение об ошибке:
org.elasticsearch.ElasticsearchStatusException: исключение Elasticsearch [type = parsing_exception, причина = нет [запрос], зарегистрированный для [field]] в org.elasticsearch.rest.BytesRestResponse.errorFromXContent (BytesRestResponse. java: 177) ~ [asticsearch-7.4.0.jar: 7.4 .0] at org.elasticsearch.client.RestHighLevelClient.parseEntity (RestHighLevelClient. java: 1727) ~ [asticsearch-rest-high-level-client-7.4.0.jar: 7.4.0] в org.elasticsearch.client .RestHighLevelClient.parseResponseException (RestHighLevelClient. java: 1704) ~ [asticsearch-rest-high-level-client-7.4.0.jar: 7.4.0] в org.elasticsearch.client.RestHighLevelClient.invelPhighLent *: 1467) ~ [резинки earch-rest-high-level-client-7.4.0.jar: 7.4.0] в org.elasticsearch.client.RestHighLevelClient.performRequest (RestHighLevelClient. java: 1424) ~ [asticsearch-rest-high-level-client -7.4.0.jar: 7.4.0] at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity (RestHighLevelClient. java: 1394) ~ [asticsearch-rest-high-level-client-7.4.0.jar: 7.4. 0] at org.elasticsearch.client.RestHighLevelClient.search (RestHighLevelClient. java: 930) ~ [asticsearch-rest-high-level-client-7.4.0.jar: 7.4.0] в org.springframework.data. asticsearch.core.ElasticsearchRestTemplate.search (ElasticsearchRestTemplate. java: 240) ~ [spring-data -asticsearch-4.0.0.BUILD-20200217.043541-321.jar: 4.0.0.BUILD-SNAPSHOT] в org.springframework.data .elasticsearch.repository.query.ElasticsearchStringQuery.execute (ElasticsearchStringQuery. java: 95) ~ [spring-data -asticsearch-4.0.0.BUILD-20200217.043541-321.jar: 4.0.0.BUILD-SNAPSHOT] в орг. springframework.data.repository.core.support.RepositoryFactorySuppor t $ QueryExecutorMethodInterceptor.doInvoke (RepositoryFactorySupport. java: 605) ~ [spring-data-commons-2.1.10.RELEASE.jar: 2.1.10.RELEASE] в org.springframework.data.repository.core.support.Support.RepositFore $ QueryExecutorMethodInterceptor.lambda $ invoke $ 3 (RepositoryFactorySupport. java: 595) ~ [spring-data-commons-2.1.10.RELEASE.jar: 2.1.10.RELEASE] в org.springframework.data.repository.core.support .RepositoryFactorySupport $ QueryExecutorMethodInterceptor.invoke (RepositoryFactorySupport. java: 595) ~ [spring-data-commons-2.1.10.RELEASE.jar: 2.1.10.RELEASE] в org.springframework.aop.fraocetInho.prod ReflectiveMethodInvocation. java: 185) ~ [spring-aop-5.0.4.RELEASE.jar: 5.0.4.RELEASE] в org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke (DefaultMethodInvokingor): 10) * 10). [spring-data-commons-2.1.10.RELEASE.jar: 2.1.10.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethod Invocation. java: 185) ~ [spring-aop-5.0.4.RELEASE.jar: 5.0.4.RELEASE] в org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke (ExposeInvocationInterceptor. java: 92) ~ [spring-aop-5.0.4.RELEASE.jar: 5.0.4.RELEASE] в org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation. java: 185) ~ [spring-aop-5.0.4. RELEASE.jar: 5.0.4.RELEASE] at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke (SurroundingTransactionDetectorMethodInterceptor. java: 61) -Ell.-10.10. : 2.1.10.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation. java: 185) ~ [spring-aop-5.0.4.RELEASE.jar: 5.0.4.RELEASE] в org .springframework.aop. framework.JdkDynamicAopProxy.invoke (JdkDynamicAopProxy. java: 212) ~ [spring-aop-5.0.4.RELEASE.jar: 5.0.4.RELEASE] в com.sun.proxy. $ Proxy125.findByFullAddressLike (Неизвестный источник) ~ [na: na] at sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод) ~ [na: 1.8.0_201] at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl. java: 62) ~ [na: 1.8.0_201] at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl. java: 43) ~ [na: 1.8.0_201] в java .lang.reflect.Method.invoke (Метод. java: 498) ~ [na: 1.8.0_201] на org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection (AopUtils. java: 338) ~ [spring-aop-5.0.4.RELEASE.jar: 5.0.4.RELEASE] на org.springframework. aop.framework.ReflectiveMethodInvocation.invokeJoinpoint (ReflectiveMethodInvocation. java: 197) ~ [spring-aop-5.0.4.RELEASE.jar: 5.0.4.RELEASE] в org.springframework.aop.framework. . java: 163) ~ [spring-aop-5.0.4.RELEASE.jar: 5.0.4.R ELEASE] at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke (PersistenceExceptionTranslationInterceptor. java: 139) ~ [spring-tx-5.0.4.RELEASE.jar: 5.0.4.RELEASE] в org.springframe.a. рамки 1054 *: 212) ~ [spring-aop-5.0.4.RELEASE.jar: 5.0.4.RELEASE] в com.sun.proxy. $ Proxy125.findByFullAddressLike (Неизвестный источник) ~ [na: na] в ru.evolenta .server.service.impl.ElasticQueryAddressServiceImpl.search (ElasticQueryAddressServiceImpl. java: 98) ~ [classes /: na] в ru.evolenta.server.controller.SearchController.search (SearchController. java: 53 /: na] at sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод) ~ [na: 1.8.0_201] at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl. java: 62) ~ [na: 1.8.0_201] sun.reflect.DelegatingMet hodAccessorImpl.invoke (DelegatingMethodAccessorImpl. java: 43) ~ [na: 1.8.0_201] в java .lang.reflect.Method.invoke (Метод. java: 498) ~ [na: 1.8.0_201] в org.springframework.web.method.support.InvocableHandlerMethod.doInvoke (InvocableHandlerMethod. java: 209) ~ [spring-web-5.0.4.RELEASE.jar: 5.0.4.RELEASE] в org.springframework.web.met .support.InvocableHandlerMethod.invokeForRequest (InvocableHandlerMethod. java: 136) ~ [spring-web-5.0.4.RELEASE.jar: 5.0.4.RELEASE] в org.springframework.web.servlet. mvc .method. annotation.ServletInvocableHandlerMethod.invokeAndHandle (ServletInvocableHandlerMethod. java: 102) ~ [spring-web mvc -5.0.4.RELEASE.jar: 5.0.4.RELEASE] в org.springframework.web. method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod (RequestMappingHandlerAdapter. java: 870) ~ [spring-web mvc -5.0.4.RELEASE.jar: 5.0.4.RELEASE] в org.springframework.web.servlet. * .method.annotation.RequestMappingHandlerAdapter.handleInternal (RequestMappingHandlerAdap ter. java: 776) ~ [spring-web mvc -5.0.4.RELEASE.jar: 5.0.4.RELEASE] в org.springframework.web.servlet. mvc .method.AbstractHandlerMethodAdapter.handle ( AbstractHandlerMethodAdapter. java: 87) ~ [spring-web mvc -5.0.4.RELEASE.jar: 5.0.4.RELEASE] в org.springframework.web.servlet.DispatcherServlet.doDispatch (DispatcherServlet. java: 991) ~ [spring-web mvc -5.0.4.RELEASE.jar: 5.0.4.RELEASE] по адресу org.springframework.web.servlet.DispatcherServlet.doService (DispatcherServlet. java: 925) ~ [spring- web mvc -5.0.4.RELEASE.jar: 5.0.4.RELEASE] в org.springframework.web.servlet.FrameworkServlet.processRequest (FrameworkServlet. java: 978) ~ [spring-web mvc -5.0 .4.RELEASE.jar: 5.0.4.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet (FrameworkServlet. java: 870) ~ [spring-web mvc -5.0.4.RELEASE.jar : 5.0.4.RELEASE] на javax.servlet.http.HttpServlet.service (HttpServlet. java: 635) ~ [tomcat-embed-core-8.5.28.jar: 8.5.28] в org.springframework.web.servlet.FrameworkServlet.service (FrameworkServlet . java: 855) ~ [spring-web mvc -5.0.4.RELEASE.jar: 5.0.4.RELEASE] по адресу javax.servlet.http.HttpServlet.service (HttpServlet. java: 742) ~ [tomcat-embed-core-8.5.28.jar: 8.5.28] в org. apache .catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 231) ~ [tomcat-embed-core-8.5. 28.jar: 8.5.28] at org. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 166) ~ [tomcat-embed-core-8.5.28.jar: 8.5.28] в org. apache .tomcat.websocket.server.WsFilter.doFilter (WsFilter. java: 52) ~ [tomcat-embed-websocket-8.5.28.jar: 8.5.28] в орг. apache .catalina .core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 193) ~ [tomcat-embed-core-8.5.28.jar: 8.5.28] at org. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 166) ~ [tomcat-embed-core -8.5.28.jar: 8.5.28] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics (WebMvcMetricsFilter. java: 158) ~ [spring-boot-activator-2.0.0. RELEASE.jar: 2.0.0.RELEASE] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics (WebMvcMetricsFilter. java: 126) ~ [spring-boot-activELE-2.0R. .jar: 2.0.0.RELEASE] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal (WebMvcMetricsFilter. java: 111) ~ [spring-boot-activator-2.0.0.RELEASE. jar: 2.0.0.RELEASE] в org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter. java: 107) ~ [spring-web-5.0.4.RELEASE.jar: 5.0.4.RELEASE] в org. apache .catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 193) ~ [tomcat-embed-core-8.5.28.jar: 8.5.28] в org. apache .catalina.core .ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 166) ~ [tomcat-embed-core-8.5.28.jar: 8.5.28] в организации .springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal (HttpTraceFilter. java: 84) ~ [spring-boot-actator-2.0.0.RELEASE.jar: 2.0.0.RELEASE] в орг. springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter. java: 107) ~ [spring-web-5.0.4.RELEASE.jar: 5.0.4.RELEASE] в орг. apache .catalina.core.ApplicationFilterChain .internalDoFilter (ApplicationFilterChain. java: 193) ~ [tomcat-embed-core-8.5.28.jar: 8.5.28] в орг. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 166) ~ [tomcat-embed-core-8.5.28.jar: 8.5.28] на ru.evolenta.server.filters.SimpleCORSFilter.doFilter (SimpleCORSFilter. java: 51) ~ [classes /: na] в организации . apache .catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 193) ~ [tomcat-embed-core-8.5.28.jar: 8.5.28] в орг. apache .catalina.core. ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 166) ~ [tomcat-embed-core-8.5.28.jar: 8.5.28] в org.springframework.web.filter.Characte rEncodingFilter.doFilterInternal (CharacterEncodingFilter. java: 200) ~ [spring-web-5.0.4.RELEASE.jar: 5.0.4.RELEASE] в org.springframework.web.filter.OncePerRequestFilter.doFilter * OncePerRequest 11 : 107) ~ [spring-web-5.0.4.RELEASE.jar: 5.0.4.RELEASE] в орг. apache .catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 193) ~ [tomcat- embed-core-8.5.28.jar: 8.5.28] at org. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 166) ~ [tomcat-embed-core-8.5.28.jar : 8.5.28] at org.springframework.security.web.FilterChainProxy.doFilterInternal (FilterChainProxy. java: 209) ~ [spring-security-web-5.0.3.RELEASE.jar: 5.0.3.RELEASE] в org .springframework.security.web.FilterChainProxy.doFilter (FilterChainProxy. java: 178) ~ [spring-security-web-5.0.3.RELEASE. jar: 5.0.3.RELEASE] на org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate (DelegatingFilterProxy. java: 357) ~ [spring-web-5.0.4.RELEASE.jar: 5.0.4.RELEASE] на org.springframework.web.filter.DelegatingFilterProxy.doFilter (DelegatingFilterProxy. java: 270) ~ [spring-web-5.0.4.RELEASE.jar: 5.0.4.RELEASE] в org. apache .catalina.core .ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 193) ~ [tomcat-embed-core-8.5.28.jar: 8.5.28] в орг. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain. * 11 *: 166) ~ [tomcat-embed-core-8.5.28.jar: 8.5.28] на org.springframework.web.filter.RequestContextFilter.doFilterInternal (RequestContextFilter. java: 99) ~ [spring-web-5.0 .4.RELEASE.jar: 5.0.4.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter. java: 107) ~ [spring-web-5.0.4.RELEASE.jar: 5.0. 4.RELEASE] at org. apache .catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 193) ~ [tomcat-embe d-core-8.5.28.jar: 8.5.28] at org. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 166) ~ [tomcat-embed-core-8.5.28.jar : 8.5.28] at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal (HttpPutFormContentFilter. java: 109) ~ [spring-web-5.0.4.RELEASE.jar: 5.0.4.RELEASE] в org.springframe .web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter. java: 107) ~ [spring-web-5.0.4.RELEASE.jar: 5.0.4.RELEASE] в орг. apache .catalina.core.ApplicationFilterChain. internalDoFilter (ApplicationFilterChain. java: 193) ~ [tomcat-embed-core-8.5.28.jar: 8.5.28] в орг. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 166 ) ~ [tomcat-embed-core-8.5.28.jar: 8.5.28] в org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal (HiddenHttpMethodFilter. java: 81) ~ [spring-web-5.0.4. RELEASE.jar: 5.0.4.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter. java: 107) ~ [spring-we b-5.0.4.RELEASE.jar: 5.0.4.RELEASE] at org. apache .catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 193) ~ [tomcat-embed-core-8.5.28 .jar: 8.5.28] at org. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 166) ~ [tomcat-embed-core-8.5.28.jar: 8.5.28] в org . apache .catalina.core.StandardWrapperValve.invoke (StandardWrapperValve. java: 199) ~ [tomcat-embed-core-8.5.28.jar: 8.5.28] в орг. apache .catalina.core. StandardContextValve.invoke (StandardContextValve. java: 96) [tomcat-embed-core-8.5.28.jar: 8.5.28] в орг. apache .catalina.authenticator.AuthenticatorBase.invoke (AuthenticatorBase. java: 496) [tomcat-embed-core-8.5.28.jar: 8.5.28] в орг. apache .catalina.core.StandardHostValve.invoke (StandardHostValve. java: 140) [tomcat-embed-core-8.5 .28.jar: 8.5.28] в орг. apache .catalina.valves.ErrorReportValve.invoke (ErrorReportValve. java: 81) [tomcat-embed-core-8.5.28.jar: 8.5.28] в орг. apache .catalina.core.StandardEngineValve.invoke (Стандарты в ngineValve. java: 87) [tomcat-embed-core-8.5.28.jar: 8.5.28] в орг. apache .catalina.connector.CoyoteAdapter.service (CoyoteAdapter. java: 342) [tomcat -embed-core-8.5.28.jar: 8.5.28] в орг. apache .coyote.http11.Http11Processor.service (Http11Processor. java: 803) [tomcat-embed-core-8.5.28.jar : 8.5.28] at org. apache .coyote.AbstractProcessorLight.process (AbstractProcessorLight. java: 66) [tomcat-embed-core-8.5.28.jar: 8.5.28] в org. apache. coyote.AbstractProtocol $ ConnectionHandler.process (AbstractProtocol. java: 790) [tomcat-embed-core-8.5.28.jar: 8.5.28] в орг. apache .tomcat.util. net .NioEndpoint $ SocketProcessor.doRun (NioEndpoint. java: 1459) [tomcat-embed-core-8.5.28.jar: 8.5.28] в org. apache .tomcat.util. net .SocketProcessorBase.run (SocketProcessorBase. java: 49) [tomcat-embed-core-8.5.28.jar: 8.5.28] в java .util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor. java: 1149) [na: 1.8.0_201] в java. util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor. java: 624) [na: 1.8.0_201] в орг. apache .tomcat.util.threads.TaskThread $ WrappingRunnable.run (TaskThread. java: 61) [tomcat-embed-core-8.5.28.jar: 8.5.28] в java .lang.Thread.run (Thread. java: 748) [na: 1.8.0_201] Подавлено: org.elasticsearch.client.ResponseException: метод [POST], хост [http://localhost: 9200] , URI [/ address / _search? typed_keys = true & ignore_unavailable = false & expand_wildcards = open & allow_no_indices = true & ign______________===__t__t_?re_S_T_F_D_T_S_D_T_S_T_S = true], строка состояния [HTTP / 1.1 400 Bad Request] {"error": {"root_cause": [{"type": "parsing_exception", "reason": "нет [запрос], зарегистрированный для [field]", "строка": 1, "столбец": 32}], "тип": "исключение parsing", "причина": "нет [запрос], зарегистрированный для [поля]", "строка": 1, "столбец": 32} , "status": 400} at org.elasticsearch.client.RestClient.convertResponse (RestClient. java: 253) ~ [asticsearch-rest-client-7.4.0.jar: 7.4.0] в орг. asticsearch.client.RestClient.performRequest (RestClient. java: 231) ~ [asticsearch-rest-client-7.4.0.jar: 7.4.0] в org.elasticsearch.client.RestClient.performRequest (RestClient. java : 205) ~ [asticsearch-rest-client-7.4.0.jar: 7.4.0] в org.elasticsearch.client.RestHighLevelClient.internalPerformRequest (RestHighLevelClient. java: 1454) ~ [asticsearch-rest-high-level- client-7.4.0.jar: 7.4.0] ... 103 общих кадра опущено
Что нужно сделать, чтобы устранить ошибку go?