问:
LIKE in ElasticSearch
I have a project on Spring data elasticSearch.
Model:

```<code>@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;
    }
}
</code>```

Repository (fullAddress == "*Russia Moscow*"; without @Query, the method does not work with a key containing a space)

```<code>@Repository
public interface AddressElasticRepository extends ElasticsearchRepository<Address, String> {
    @Query("{\"bool\" : {\"must\" : {\"field\" : {\"fullAddress\" : {\"query\" : \"?\",\"analyze_wildcard\" : true}}}}}")
    List<Address> findByFullAddressLike(String fullAddress);
}
</code>```

My index in Elastic:

```<code>{
  "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"
        }
      }
    }
  }
}
</code>```

When I make a call to the findByFullAddressLike method, I get an error:

org.elasticsearch.ElasticsearchStatusException: Elasticsearch
  exception [type=parsing_exception, reason=no [query] registered for
  [field]]    at
  org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177)
  ~[elasticsearch-7.4.0.jar:7.4.0]  at
  org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1727)
  ~[elasticsearch-rest-high-level-client-7.4.0.jar:7.4.0]   at
  org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:1704)
  ~[elasticsearch-rest-high-level-client-7.4.0.jar:7.4.0]   at
  org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1467)
  ~[elasticsearch-rest-high-level-client-7.4.0.jar:7.4.0]   at
  org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1424)
  ~[elasticsearch-rest-high-level-client-7.4.0.jar:7.4.0]   at
  org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1394)
  ~[elasticsearch-rest-high-level-client-7.4.0.jar:7.4.0]   at
  org.elasticsearch.client.RestHighLevelClient.search(RestHighLevelClient.java:930)
  ~[elasticsearch-rest-high-level-client-7.4.0.jar:7.4.0]   at
  org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.search(ElasticsearchRestTemplate.java:240)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.repository.query.ElasticsearchStringQuery.execute(ElasticsearchStringQuery.java:95)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:605)
  ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]  at
  org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$invoke$3(RepositoryFactorySupport.java:595)
  ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]  at
  org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:595)
  ~[spring-data-commons-2.1.10.RELEASE.jar: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]     at
  org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:59)
  ~[spring-data-commons-2.1.10.RELEASE.jar: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]     at
  org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
  ~[spring-aop-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  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)
  ~[spring-data-commons-2.1.10.RELEASE.jar: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]     at
  org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
  ~[spring-aop-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  com.sun.proxy.$Proxy125.findByFullAddressLike(Unknown Source) ~[na:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  ~[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]   at java.lang.reflect.Method.invoke(Method.java:498)
  ~[na:1.8.0_201]   at
  org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:338)
  ~[spring-aop-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:197)
  ~[spring-aop-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
  ~[spring-aop-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
  ~[spring-tx-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
  ~[spring-aop-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
  ~[spring-aop-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  com.sun.proxy.$Proxy125.findByFullAddressLike(Unknown Source) ~[na:na]
    at
  ru.evolenta.server.service.impl.ElasticQueryAddressServiceImpl.search(ElasticQueryAddressServiceImpl.java:98)
  ~[classes/:na]    at
  ru.evolenta.server.controller.SearchController.search(SearchController.java:53)
  ~[classes/:na]    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
  Method) ~[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]   at java.lang.reflect.Method.invoke(Method.java:498)
  ~[na:1.8.0_201]   at
  org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
  ~[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
  ~[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
  ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:870)
  ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:776)
  ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
  ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
  ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
  ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)
  ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:870)
  ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
  ~[tomcat-embed-core-8.5.28.jar:8.5.28]    at
  org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:855)
  ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
  ~[tomcat-embed-core-8.5.28.jar:8.5.28]    at
  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]    at
  org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  ~[tomcat-embed-websocket-8.5.28.jar:8.5.28]   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]    at
  org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:158)
  ~[spring-boot-actuator-2.0.0.RELEASE.jar:2.0.0.RELEASE]   at
  org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:126)
  ~[spring-boot-actuator-2.0.0.RELEASE.jar:2.0.0.RELEASE]   at
  org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:111)
  ~[spring-boot-actuator-2.0.0.RELEASE.jar:2.0.0.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-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.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:84)
  ~[spring-boot-actuator-2.0.0.RELEASE.jar:2.0.0.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-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
  ru.evolenta.server.filters.SimpleCORSFilter.doFilter(SimpleCORSFilter.java:51)
  ~[classes/:na]    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]    at
  org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
  ~[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-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]    at
  org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
  ~[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE]    at
  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
  ~[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
  ~[spring-web-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]    at
  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-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.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
  ~[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-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.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-web-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]    at
  org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
  ~[tomcat-embed-core-8.5.28.jar:8.5.28]    at
  org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  org.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]     at
  org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  [na:1.8.0_201]    at
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  [na:1.8.0_201]    at
  org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  java.lang.Thread.run(Thread.java:748) [na:1.8.0_201]  Suppressed:
  org.elasticsearch.client.ResponseException: method [POST], host
  [http://localhost:9200], URI
  [/address/_search?typed_keys=true&ignore_unavailable=false&expand_wildcards=open&allow_no_indices=true&ignore_throttled=true&search_type=dfs_query_then_fetch&batched_reduce_size=512&ccs_minimize_roundtrips=true],
  status line [HTTP/1.1 400 Bad Request]
  {"error":{"root_cause":[{"type":"parsing_exception","reason":"no
  [query] registered for
  [field]","line":1,"col":32}],"type":"parsing_exception","reason":"no
  [query] registered for [field]","line":1,"col":32},"status":400}        at
  org.elasticsearch.client.RestClient.convertResponse(RestClient.java:253)
  ~[elasticsearch-rest-client-7.4.0.jar:7.4.0]      at
  org.elasticsearch.client.RestClient.performRequest(RestClient.java:231)
  ~[elasticsearch-rest-client-7.4.0.jar:7.4.0]      at
  org.elasticsearch.client.RestClient.performRequest(RestClient.java:205)
  ~[elasticsearch-rest-client-7.4.0.jar:7.4.0]      at
  org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1454)
  ~[elasticsearch-rest-high-level-client-7.4.0.jar:7.4.0]       ... 103
  common frames omitted

What should I do to make the error go away?

答:
The error states

no [query] registered for [field]

You're query is not correct (i.e. field is not a valid query), it should be

```<code>@Query("{\"bool\":{\"must\":{\"query_string\":{\"query\":\"?\",\"default_field\":\"fullAddress\",\"analyze_wildcard\":true}}}}")
</code>```

Title: LIKE in ElasticSearch

Body:
I have a project on Spring data elasticSearch.
Model:

@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;
    }
}

Repository (fullAddress == "*Russia Moscow*"; without @Query, the method does not work with a key containing a space)

@Repository
public interface AddressElasticRepository extends ElasticsearchRepository<Address, String> {
    @Query("{\"bool\" : {\"must\" : {\"field\" : {\"fullAddress\" : {\"query\" : \"?\",\"analyze_wildcard\" : true}}}}}")
    List<Address> findByFullAddressLike(String fullAddress);
}

My index in Elastic:

{
  "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"
        }
      }
    }
  }
}

When I make a call to the findByFullAddressLike method, I get an error:

org.elasticsearch.ElasticsearchStatusException: Elasticsearch
  exception [type=parsing_exception, reason=no [query] registered for
  [field]]    at
  org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177)
  ~[elasticsearch-7.4.0.jar:7.4.0]  at
  org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1727)
  ~[elasticsearch-rest-high-level-client-7.4.0.jar:7.4.0]   at
  org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:1704)
  ~[elasticsearch-rest-high-level-client-7.4.0.jar:7.4.0]   at
  org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1467)
  ~[elasticsearch-rest-high-level-client-7.4.0.jar:7.4.0]   at
  org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1424)
  ~[elasticsearch-rest-high-level-client-7.4.0.jar:7.4.0]   at
  org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1394)
  ~[elasticsearch-rest-high-level-client-7.4.0.jar:7.4.0]   at
  org.elasticsearch.client.RestHighLevelClient.search(RestHighLevelClient.java:930)
  ~[elasticsearch-rest-high-level-client-7.4.0.jar:7.4.0]   at
  org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.search(ElasticsearchRestTemplate.java:240)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.repository.query.ElasticsearchStringQuery.execute(ElasticsearchStringQuery.java:95)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:605)
  ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]  at
  org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$invoke$3(RepositoryFactorySupport.java:595)
  ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]  at
  org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:595)
  ~[spring-data-commons-2.1.10.RELEASE.jar: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]     at
  org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:59)
  ~[spring-data-commons-2.1.10.RELEASE.jar: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]     at
  org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
  ~[spring-aop-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  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)
  ~[spring-data-commons-2.1.10.RELEASE.jar: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]     at
  org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
  ~[spring-aop-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  com.sun.proxy.$Proxy125.findByFullAddressLike(Unknown Source) ~[na:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  ~[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]   at java.lang.reflect.Method.invoke(Method.java:498)
  ~[na:1.8.0_201]   at
  org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:338)
  ~[spring-aop-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:197)
  ~[spring-aop-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
  ~[spring-aop-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
  ~[spring-tx-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
  ~[spring-aop-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
  ~[spring-aop-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  com.sun.proxy.$Proxy125.findByFullAddressLike(Unknown Source) ~[na:na]
    at
  ru.evolenta.server.service.impl.ElasticQueryAddressServiceImpl.search(ElasticQueryAddressServiceImpl.java:98)
  ~[classes/:na]    at
  ru.evolenta.server.controller.SearchController.search(SearchController.java:53)
  ~[classes/:na]    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
  Method) ~[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]   at java.lang.reflect.Method.invoke(Method.java:498)
  ~[na:1.8.0_201]   at
  org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
  ~[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
  ~[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
  ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:870)
  ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:776)
  ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
  ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
  ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
  ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)
  ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:870)
  ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
  ~[tomcat-embed-core-8.5.28.jar:8.5.28]    at
  org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:855)
  ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]  at
  javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
  ~[tomcat-embed-core-8.5.28.jar:8.5.28]    at
  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]    at
  org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  ~[tomcat-embed-websocket-8.5.28.jar:8.5.28]   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]    at
  org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:158)
  ~[spring-boot-actuator-2.0.0.RELEASE.jar:2.0.0.RELEASE]   at
  org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:126)
  ~[spring-boot-actuator-2.0.0.RELEASE.jar:2.0.0.RELEASE]   at
  org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:111)
  ~[spring-boot-actuator-2.0.0.RELEASE.jar:2.0.0.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-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.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:84)
  ~[spring-boot-actuator-2.0.0.RELEASE.jar:2.0.0.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-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
  ru.evolenta.server.filters.SimpleCORSFilter.doFilter(SimpleCORSFilter.java:51)
  ~[classes/:na]    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]    at
  org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
  ~[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-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]    at
  org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
  ~[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE]    at
  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
  ~[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
  ~[spring-web-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]    at
  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-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.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
  ~[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-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.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-web-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]    at
  org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
  ~[tomcat-embed-core-8.5.28.jar:8.5.28]    at
  org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  org.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]     at
  org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  [na:1.8.0_201]    at
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  [na:1.8.0_201]    at
  org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  [tomcat-embed-core-8.5.28.jar:8.5.28]     at
  java.lang.Thread.run(Thread.java:748) [na:1.8.0_201]  Suppressed:
  org.elasticsearch.client.ResponseException: method [POST], host
  [http://localhost:9200], URI
  [/address/_search?typed_keys=true&ignore_unavailable=false&expand_wildcards=open&allow_no_indices=true&ignore_throttled=true&search_type=dfs_query_then_fetch&batched_reduce_size=512&ccs_minimize_roundtrips=true],
  status line [HTTP/1.1 400 Bad Request]
  {"error":{"root_cause":[{"type":"parsing_exception","reason":"no
  [query] registered for
  [field]","line":1,"col":32}],"type":"parsing_exception","reason":"no
  [query] registered for [field]","line":1,"col":32},"status":400}        at
  org.elasticsearch.client.RestClient.convertResponse(RestClient.java:253)
  ~[elasticsearch-rest-client-7.4.0.jar:7.4.0]      at
  org.elasticsearch.client.RestClient.performRequest(RestClient.java:231)
  ~[elasticsearch-rest-client-7.4.0.jar:7.4.0]      at
  org.elasticsearch.client.RestClient.performRequest(RestClient.java:205)
  ~[elasticsearch-rest-client-7.4.0.jar:7.4.0]      at
  org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1454)
  ~[elasticsearch-rest-high-level-client-7.4.0.jar:7.4.0]       ... 103
  common frames omitted

What should I do to make the error go away?

Body:
The error states

no [query] registered for [field]

You're query is not correct (i.e. field is not a valid query), it should be

@Query("{\"bool\":{\"must\":{\"query_string\":{\"query\":\"?\",\"default_field\":\"fullAddress\",\"analyze_wildcard\":true}}}}")


来源: stackexchange

问:
Sharedprefrences not saving?
When i try to save a variable to shared preferences then call it in an editext it is not being saved? I've been looking around for hours but i cannot find anything on it. I know that sharedPrefrences acts like a dictionary in a way but other than that i don't understand why this is not working :(</p>

```<code>package com.example.gatorblocks;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.wearable.activity.WearableActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class block1Settings extends WearableActivity{

    private TextView mTextView;

    Context context = this;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_block1_settings);
        configureBackButton();
        configureColor();

        Button addTextButton = (Button) findViewById(R.id.Apply);
        TextView simpleEditText =  findViewById(R.id.simpleEditText);
        SharedPreferences prefs = getSharedPreferences("classes.txt", 0);
        simpleEditText.setText(prefs.getString("classes1","1-1"));                 //set textbox to equal current class

        final EditText vEditText = (EditText) findViewById(R.id.simpleEditText);

        mTextView = (TextView) findViewById(R.id.text);

        // Enables Always-on
        setAmbientEnabled();

        addTextButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String enteredText = vEditText.getText().toString();        //sets the array value of block to the editText
                test(enteredText);

            }
        });
    }
    private void configureColor() {
        Button Block1 = (Button) findViewById(R.id.colorButton);
        Block1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(block1Settings.this, colorBlock1.class));
                overridePendingTransition(R.anim.slide_in_right,R.anim.slide_out_left);
            }
        });
    }

    private void configureBackButton(){
        Button backbutton = (Button) findViewById(R.id.backButton);
        backbutton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                startActivity(new Intent(block1Settings.this, classes.class));
                overridePendingTransition(R.anim.slide_in_left,R.anim.slide_out_right);
                finish();

            }
        });
    }
    public void test(String enteredText){
        SharedPreferences pref = getSharedPreferences("classes.txt", 0);
        SharedPreferences.Editor editor = pref.edit();
        editor.putString("class1", enteredText);
        editor.apply();
    }

}
</code>```

答:
How did you get data from SharedPreferences which is not saved? You saved data using key class1 and want to get it by classes1 which is not correct way. You have to use same key. Try using

```<code>SharedPreferences prefs = getSharedPreferences("classes.txt", 0);
simpleEditText.setText(prefs.getString("class1","1-1"));
</code>```

ContentLicense: CC BY-SA 4.0

Title: Sharedprefrences not saving?

Body:
When i try to save a variable to shared preferences then call it in an editext it is not being saved? I've been looking around for hours but i cannot find anything on it. I know that sharedPrefrences acts like a dictionary in a way but other than that i don't understand why this is not working :(

package com.example.gatorblocks;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.wearable.activity.WearableActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class block1Settings extends WearableActivity{

    private TextView mTextView;

    Context context = this;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_block1_settings);
        configureBackButton();
        configureColor();

        Button addTextButton = (Button) findViewById(R.id.Apply);
        TextView simpleEditText =  findViewById(R.id.simpleEditText);
        SharedPreferences prefs = getSharedPreferences("classes.txt", 0);
        simpleEditText.setText(prefs.getString("classes1","1-1"));                 //set textbox to equal current class

        final EditText vEditText = (EditText) findViewById(R.id.simpleEditText);

        mTextView = (TextView) findViewById(R.id.text);

        // Enables Always-on
        setAmbientEnabled();

        addTextButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String enteredText = vEditText.getText().toString();        //sets the array value of block to the editText
                test(enteredText);

            }
        });
    }
    private void configureColor() {
        Button Block1 = (Button) findViewById(R.id.colorButton);
        Block1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(block1Settings.this, colorBlock1.class));
                overridePendingTransition(R.anim.slide_in_right,R.anim.slide_out_left);
            }
        });
    }

    private void configureBackButton(){
        Button backbutton = (Button) findViewById(R.id.backButton);
        backbutton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                startActivity(new Intent(block1Settings.this, classes.class));
                overridePendingTransition(R.anim.slide_in_left,R.anim.slide_out_right);
                finish();

            }
        });
    }
    public void test(String enteredText){
        SharedPreferences pref = getSharedPreferences("classes.txt", 0);
        SharedPreferences.Editor editor = pref.edit();
        editor.putString("class1", enteredText);
        editor.apply();
    }

}

Body:
How did you get data from SharedPreferences which is not saved? You saved data using key class1 and want to get it by classes1 which is not correct way. You have to use same key. Try using

SharedPreferences prefs = getSharedPreferences("classes.txt", 0);
simpleEditText.setText(prefs.getString("class1","1-1"));


问:
Postgres query nested JSONB
I have a JSONB column containing list of objects.>

Here's the table schema:

```<code>column Name | Datatype
---------------------
timestamp   | timestamp
  data      | JSONB
</code>```

Sample Data

1.

```<code>timestamp : 2020-02-02 19:01:21.571429+00
</code>```

```<code>data : [
  {
    "tracker_id": "5",
    "position": 1
  },
  {
    "tracker_id": "11",
    "position": 2
  },
  {
    "tracker_id": "4",
    "position": 1
  }
]
</code>```

2.

```<code>timestamp : 2020-02-02 19:01:23.571429+00
</code>```

```<code>data : [
  {
    "tracker_id": "7",
    "position": 3
  },
  {
    "tracker_id": "4",
    "position": 2
  }
]
</code>```

3.

```<code>timestamp : 2020-02-02 19:02:23.571429+00
</code>```

```<code>data : [
  {
    "tracker_id": "5",
    "position": 2
  },
  {
    "tracker_id": "4",
    "position": 1
  }
]
</code>```

I need to find the count of the transitions of tracker_id from position: 1 to position: 2

Here, the output will be 2, since tracker_id 4 and 5 changed their position from 1 to 2.

Note

The transition should be in ascending order depending on the timestamp

The position change need not to be in the consecutive records.

I'm using timescaledb extension

So far I've tried querying the objects in the list od individual record, but I'm not sure how to merge the list objects of each record and query them.

What would be the query for this? Should I write down a stored procedure instead?

答:
There are various functions that will help compose several database rows into a single JSON structure: row_to_json(), array_to_json(), and, array_agg().

You will then use the usual SELECT with an ORDER BY clause to get the timestamps/JSON data you want and the use above functions to create a single JSON struture.

Title: Postgres query nested JSONB

Body:
I have a JSONB column containing list of objects.>

Here's the table schema:

column Name | Datatype
---------------------
timestamp   | timestamp
  data      | JSONB

Sample Data

1.

timestamp : 2020-02-02 19:01:21.571429+00

data : [
  {
    "tracker_id": "5",
    "position": 1
  },
  {
    "tracker_id": "11",
    "position": 2
  },
  {
    "tracker_id": "4",
    "position": 1
  }
]

2.

timestamp : 2020-02-02 19:01:23.571429+00

data : [
  {
    "tracker_id": "7",
    "position": 3
  },
  {
    "tracker_id": "4",
    "position": 2
  }
]

3.

timestamp : 2020-02-02 19:02:23.571429+00

data : [
  {
    "tracker_id": "5",
    "position": 2
  },
  {
    "tracker_id": "4",
    "position": 1
  }
]

I need to find the count of the transitions of tracker_id from position: 1 to position: 2

Here, the output will be 2, since tracker_id 4 and 5 changed their position from 1 to 2.

Note

The transition should be in ascending order depending on the timestamp

The position change need not to be in the consecutive records.

I'm using timescaledb extension

So far I've tried querying the objects in the list od individual record, but I'm not sure how to merge the list objects of each record and query them.

What would be the query for this? Should I write down a stored procedure instead?


问:
python opens text file with a space between every character
Whenever I try to open a .csv file with the python command
fread = open('input.csv', 'r')
it always opens the file with spaces between every single character.  I'm guessing it's something wrong with the text file because I can open other text files with the same command and they are loaded correctly.  Does anyone know why a text file would load like this in python?

Thanks.

Update

Ok, I got it with the help of Jarret Hardie's post

this is the code that I used to convert the file to ascii

```<code>fread = open('input.csv', 'rb').read()
mytext = fread.decode('utf-16')
mytext = mytext.encode('ascii', 'ignore')
fwrite = open('input-ascii.csv', 'wb')
fwrite.write(mytext)
</code>```

Thanks!

答:
Isn't csv a simple txt file with values separated with comma.
Just try to open it with a text editor to see if the file is correctly formed.</p>

ContentLicense: CC BY-SA 2.5

Body:
Whenever I try to open a .csv file with the python command
fread = open('input.csv', 'r')
it always opens the file with spaces between every single character.  I'm guessing it's something wrong with the text file because I can open other text files with the same command and they are loaded correctly.  Does anyone know why a text file would load like this in python?

Thanks.

Update

Ok, I got it with the help of Jarret Hardie's post

this is the code that I used to convert the file to ascii

fread = open('input.csv', 'rb').read()
mytext = fread.decode('utf-16')
mytext = mytext.encode('ascii', 'ignore')
fwrite = open('input-ascii.csv', 'wb')
fwrite.write(mytext)

Thanks!

LastEditorDisplayName: ΤΖΩΤΖΙΟΥ

OwnerDisplayName: dex


问:
flutter want call parent view upon its child to refresh main view
I have a Stateful widget that has a child buttons and set of stateful containers (visible and invisible).
I want to try here is when i call the specific button, the specific button will refresh all layout and change it on its specifict view by setting visible while the others are not visible.

like this:

```<code>button1 = view1;
button2 = view2;
button3 = view3;

if (button1 is pressed){
view1 is visible}
 else{
not visible}
</code>```

upon my code, upon my first view(login button),I've set to go with my main_page like this:

```<code>child: MaterialButton(
        minWidth: MediaQuery.of(context).size.width,
        padding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0),
        onPressed: () {
          Navigator.push(
            context,
            MaterialPageRoute(builder: (context) => MainPage(change1: true,change2: false,change3: false,)),
          );
        },

now i was display my main_page view (with a child view  that has visibility property).
</code>```

this is my code on main_page:

```<code>class MainPage extends StatefulWidget {

  final bool change1 ;
  final bool change2;
  final bool change3 ;

  const MainPage({Key key, this.change1,this.change2,this.change3}) : super(key: key);

  @override
  _MainPageState createState() => _MainPageState();

}

class _MainPageState extends State<MainPage> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Column(
          children: <Widget>[
            Container(
              constraints: BoxConstraints.expand(
                height: 280.0,
              ),
              decoration: BoxDecoration(
                image: new DecorationImage(
                  fit: BoxFit.cover,
                  colorFilter: new ColorFilter.mode(
                      Colors.blueAccent, BlendMode.colorBurn),
                  image: new ExactAssetImage("images/vector.jpg"),
                ),
              ),
              child: Stack(
                children: <Widget>[

                  Container(
                    alignment: Alignment.bottomCenter,
                    child: Row(
                      children: <Widget>[
                        Expanded(
                          child: GestureDetector(
                            onTap: () {
                              setState(() {
                                print("i pressed Official Business");

                                 MainPage(change1: true,change2: false,change3: false);
                                  //TODO: here is my problem, when i call the main_page on its page,
                                //        the value of change1, change2, and chaange3 is not updating
                                 //       so that icanot update my view .

                              });
                            },
                            child: Container(
                              height: 50.0,
                              child: Padding(
                                padding: const EdgeInsets.all(10.0),
                                child: Center(
                                  child: Text(
                                    "Official Business",
                                    style: TextStyle(
                                        fontSize: 20.0, color: Colors.white),
                                  ),
                                ),
                              ),
                            ),
                          ),
                        ),
                        Expanded(
                          child: GestureDetector(
                            onTap: () {
                              setState(() {
                                print("i pressed file an OB");
                                 MainPage(change1: false,change2: true,change3: false);

                                //TODO: here is my problem, when i call the main_page on its page,
                                //        the value of change1, change2, and chaange3 is not updating
                                 //       so that icanot update my view .

                              });
                            },
                            child: Container(
                              height: 50.0,
                              child: Padding(
                                padding: const EdgeInsets.all(10.0),
                                child: Center(
                                  child: Text(
                                    "File an OB",
                                    style: TextStyle(
                                        fontSize: 20.0, color: Colors.white),
                                  ),
                                ),
                              ),
                            ),
                          ),
                        ),
                      ],
                    ),
                  ),

                ],
              ),
            ),
            //TODO:
            new Visibility(
              //Called changed and viewOne
              visible: widget.change1,
              child: OfficialBusiness(),
            ),
            new Visibility(
              //Called not changed and viewTwo
              visible: widget.change2,
              child: FilingOb(),
            ),
            new Visibility(
              //Called not changed and viewTwo
              visible: widget.change3,
              child: ViewOfficialBusiness(),
            )

     ],
    ),
  ),
);
</code>```

}
}

the fillingob/officialbusiness/ViewOfficialBusiness includded was set of stateful layout, i didn't add the code to prevent over views.

sorry, in new on this programming language and i've like to enlighten with these problems i've encountered if my code is possible or not.Also if you need more reference just ping on comment so that i can provide my other codes

答:
In Flutter, the standard way to call functions on a parent widget when something occurs in one of its children would be to pass a function from the parent widget to the child, so that the function gets triggered from the child, with data that only the parent widget knows.

In your case, in your first view, you could define a new method like this:

void onChildPressed() {
    setState(() {
       // Here you change the boolean change1, change2, whatever you want
    });
}
```

<p>And then, in the child view, you have to define a function parameter, such that your child can receive the function as a parameter, and trigger it from wherever you want in your child widget. </p>

<pre class="lang-dart prettyprint-override"><code>class MainPage extends StatefulWidget {

  final bool change1 ;
  final bool change2;
  final bool change3 ;
  final void Function() onPressed;

  const MainPage({Key key, this.change1,this.change2,this.change3, this.onPressed}) : super(key: key);

  @override
  _MainPageState createState() => _MainPageState();

}
</code>```

This way, you can instantiate the MainPage from your first view like this:

MainPage(change1: false,change2: true,change3: false, onPressed: onChildPressed);
```

And, finally, you can call the onPressed function in your MainPage, so that your child view updates the parent view the way you want.

Body:
I have a Stateful widget that has a child buttons and set of stateful containers (visible and invisible).
I want to try here is when i call the specific button, the specific button will refresh all layout and change it on its specifict view by setting visible while the others are not visible.

like this:

button1 = view1;
button2 = view2;
button3 = view3;

if (button1 is pressed){
view1 is visible}
 else{
not visible}

upon my code, upon my first view(login button),I've set to go with my main_page like this:

child: MaterialButton(
        minWidth: MediaQuery.of(context).size.width,
        padding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0),
        onPressed: () {
          Navigator.push(
            context,
            MaterialPageRoute(builder: (context) => MainPage(change1: true,change2: false,change3: false,)),
          );
        },

now i was display my main_page view (with a child view  that has visibility property).

this is my code on main_page:

class MainPage extends StatefulWidget {

  final bool change1 ;
  final bool change2;
  final bool change3 ;

  const MainPage({Key key, this.change1,this.change2,this.change3}) : super(key: key);

  @override
  _MainPageState createState() => _MainPageState();

}

class _MainPageState extends State<MainPage> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Column(
          children: <Widget>[
            Container(
              constraints: BoxConstraints.expand(
                height: 280.0,
              ),
              decoration: BoxDecoration(
                image: new DecorationImage(
                  fit: BoxFit.cover,
                  colorFilter: new ColorFilter.mode(
                      Colors.blueAccent, BlendMode.colorBurn),
                  image: new ExactAssetImage("images/vector.jpg"),
                ),
              ),
              child: Stack(
                children: <Widget>[

                  Container(
                    alignment: Alignment.bottomCenter,
                    child: Row(
                      children: <Widget>[
                        Expanded(
                          child: GestureDetector(
                            onTap: () {
                              setState(() {
                                print("i pressed Official Business");

                                 MainPage(change1: true,change2: false,change3: false);
                                  //TODO: here is my problem, when i call the main_page on its page,
                                //        the value of change1, change2, and chaange3 is not updating
                                 //       so that icanot update my view .

                              });
                            },
                            child: Container(
                              height: 50.0,
                              child: Padding(
                                padding: const EdgeInsets.all(10.0),
                                child: Center(
                                  child: Text(
                                    "Official Business",
                                    style: TextStyle(
                                        fontSize: 20.0, color: Colors.white),
                                  ),
                                ),
                              ),
                            ),
                          ),
                        ),
                        Expanded(
                          child: GestureDetector(
                            onTap: () {
                              setState(() {
                                print("i pressed file an OB");
                                 MainPage(change1: false,change2: true,change3: false);

                                //TODO: here is my problem, when i call the main_page on its page,
                                //        the value of change1, change2, and chaange3 is not updating
                                 //       so that icanot update my view .

                              });
                            },
                            child: Container(
                              height: 50.0,
                              child: Padding(
                                padding: const EdgeInsets.all(10.0),
                                child: Center(
                                  child: Text(
                                    "File an OB",
                                    style: TextStyle(
                                        fontSize: 20.0, color: Colors.white),
                                  ),
                                ),
                              ),
                            ),
                          ),
                        ),
                      ],
                    ),
                  ),

                ],
              ),
            ),
            //TODO:
            new Visibility(
              //Called changed and viewOne
              visible: widget.change1,
              child: OfficialBusiness(),
            ),
            new Visibility(
              //Called not changed and viewTwo
              visible: widget.change2,
              child: FilingOb(),
            ),
            new Visibility(
              //Called not changed and viewTwo
              visible: widget.change3,
              child: ViewOfficialBusiness(),
            )

     ],
    ),
  ),
);

}
}

the fillingob/officialbusiness/ViewOfficialBusiness includded was set of stateful layout, i didn't add the code to prevent over views.

sorry, in new on this programming language and i've like to enlighten with these problems i've encountered if my code is possible or not.Also if you need more reference just ping on comment so that i can provide my other codes

Body:
In Flutter, the standard way to call functions on a parent widget when something occurs in one of its children would be to pass a function from the parent widget to the child, so that the function gets triggered from the child, with data that only the parent widget knows.

In your case, in your first view, you could define a new method like this:

void onChildPressed() {
    setState(() {
       // Here you change the boolean change1, change2, whatever you want
    });
}

And then, in the child view, you have to define a function parameter, such that your child can receive the function as a parameter, and trigger it from wherever you want in your child widget.

class MainPage extends StatefulWidget {

  final bool change1 ;
  final bool change2;
  final bool change3 ;
  final void Function() onPressed;

  const MainPage({Key key, this.change1,this.change2,this.change3, this.onPressed}) : super(key: key);

  @override
  _MainPageState createState() => _MainPageState();

}

This way, you can instantiate the MainPage from your first view like this:

MainPage(change1: false,change2: true,change3: false, onPressed: onChildPressed);

And, finally, you can call the onPressed function in your MainPage, so that your child view updates the parent view the way you want.


问:
Add progress bar in flutter when open pdf file from url
I have a problem and I cannot solve it and I did not find a source to solve it on Google, I have a page where I view a PDF file through a link, and I have a CircularProgressIndicator and I want to replace it with a progress bar showing the percentage of downloading the file, can I do that?
I have attached my code</p>

```<code>import 'package:flutter/material.dart';
import 'package:flutter_plugin_pdf_viewer/flutter_plugin_pdf_viewer.dart';

class ReadPdf extends StatefulWidget {

  final String value;
  ReadPdf({Key key, this.value}) : super(key: key);

  @override
  _ReadPdfState createState() => _ReadPdfState();
}

class _ReadPdfState extends  State<ReadPdf>{
  bool _isloading = false, _isInit = true;
  PDFDocument document;

  @override
  void initState() {

    super.initState();

  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        backgroundColor: Color.fromRGBO(58, 66, 86, 1.0),
        body: Container(
          child: Column(
            children: <Widget>[
              Expanded(child:Center(
                child: _isInit?  MaterialButton(child: Text('Go'), onPressed: () {_loadFromURL(widget.value);},
                color: Color.fromRGBO(64, 75, 96, .9),
                textColor: Colors.white,
                ) : _isloading? Center(child: CircularProgressIndicator(),) : PDFViewer(document: document,indicatorBackground: Colors.deepPurple,),
              ),),
              Row(
                mainAxisSize: MainAxisSize.max,
                children: <Widget>[

                ],
              ),
            ],
          ),
        ),
      ),
    );
  }

  _loadFromURL(String url) async{
    setState(() {
      _isInit = false;
      _isloading = true;
    });
    document = await PDFDocument.fromURL('${url}');    setState(() {
      _isloading = false;
    });

  }

}
</code>```

答:
I have an app with the same feature, I used Dio this package supports downloading a file to your phone.

All you need to do is

```<code>Dio dio = Dio();
  dio.download("*YOUR URL WHERE YOU WANT TO DOWNLOAD A FILE*",
      "*YOUR DESTINATION PATH*", onReceiveProgress: (rec, total) {
          print("Downloading " + ((rec / total) * 100).toStringAsFixed(0) + "%");
      });
</code>```

Body:
I have a problem and I cannot solve it and I did not find a source to solve it on Google, I have a page where I view a PDF file through a link, and I have a CircularProgressIndicator and I want to replace it with a progress bar showing the percentage of downloading the file, can I do that?
I have attached my code

import 'package:flutter/material.dart';
import 'package:flutter_plugin_pdf_viewer/flutter_plugin_pdf_viewer.dart';

class ReadPdf extends StatefulWidget {

  final String value;
  ReadPdf({Key key, this.value}) : super(key: key);

  @override
  _ReadPdfState createState() => _ReadPdfState();
}

class _ReadPdfState extends  State<ReadPdf>{
  bool _isloading = false, _isInit = true;
  PDFDocument document;

  @override
  void initState() {

    super.initState();

  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        backgroundColor: Color.fromRGBO(58, 66, 86, 1.0),
        body: Container(
          child: Column(
            children: <Widget>[
              Expanded(child:Center(
                child: _isInit?  MaterialButton(child: Text('Go'), onPressed: () {_loadFromURL(widget.value);},
                color: Color.fromRGBO(64, 75, 96, .9),
                textColor: Colors.white,
                ) : _isloading? Center(child: CircularProgressIndicator(),) : PDFViewer(document: document,indicatorBackground: Colors.deepPurple,),
              ),),
              Row(
                mainAxisSize: MainAxisSize.max,
                children: <Widget>[

                ],
              ),
            ],
          ),
        ),
      ),
    );
  }

  _loadFromURL(String url) async{
    setState(() {
      _isInit = false;
      _isloading = true;
    });
    document = await PDFDocument.fromURL('${url}');    setState(() {
      _isloading = false;
    });

  }

}

Body:
I have an app with the same feature, I used Dio this package supports downloading a file to your phone.

All you need to do is

Dio dio = Dio();
  dio.download("*YOUR URL WHERE YOU WANT TO DOWNLOAD A FILE*",
      "*YOUR DESTINATION PATH*", onReceiveProgress: (rec, total) {
          print("Downloading " + ((rec / total) * 100).toStringAsFixed(0) + "%");
      });


问:
How i can use custom domain in google app engine?
Hi Google Cloud experts,
I want to use my custom domain www.example.com in App engine custom domain.I purchase domain from GoDaddy.
How can i do it.

答: Once you have purchased domain through Godaddy, you just need to point your domain to your hosting provider name server. </p>


问:
JPQL "NOT MEMBER OF" query using criteria API
Given the following JPA annotated entity classes:

```<code>@Entity
@Table("foo")
public class Foo {
    @Id private int id;
    @Column(name="name") private String name;
    @ManyToMany
    @JoinTable(name = "foo_tags",
           joinColumns = {@JoinColumn(name = "foo")},
           inverseJoinColumns = {@JoinColumn(name = "tag")})
    private Collection<Tag> tags;
    ...
}

@Entity
@Table(name = "tag")
public class Tag {
    @Id private String tag;
    ...
}
</code>```

I'm trying to formulate a query to get all Foo instances that lack a given tag. The following JPQL query does the trick

```<code>SELECT f FROM Foo f WHERE :tag NOT MEMBER OF f.tags
</code>```

However, I'm having trouble translating this into a criteria query. The translation seems obvious (to me):

```<code>CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Foo> query = cb.createQuery(Foo.class);
Root<Foo> from = query.from(Foo.class);
query.where(cb.isNotMember(cb.parameter(Tag.class, "tag"), from.get(Foo_.tags)));
TypedQuery<Foo> tq = em.createQuery(query);
return tq.setParameter("tag", sometag).getResultList();
</code>```

The generated SQL differs significantly in these cases though. The first query generates the following:

```<code>SELECT t0.id, t0.name FROM foo t0
WHERE NOT EXISTS (
    SELECT DISTINCT t2.TAG FROM tag t2, foo_tags t1
    WHERE (((t1.foo = t0.id) AND (t2.TAG = t1.tag)) AND ('blue' = t2.TAG)))
</code>```

while the criteria query generates this:

```<code>SELECT t1.id, t1.name FROM tag t0, foo_tags t2, Foo t1
WHERE (NOT ((t0.TAG = 'blue')) AND ((t2.foo = t1.id) AND (t0.TAG = t2.tag)))
</code>```

I've only tested this using the eclipselink implementation, so possibly there's a problem there, but figured I'd ask here first if anyone spots an obvious mistake.

答:
The SQL should be the same, although both seem like they would work (minus the empty case).

Please log a bug for the criteria issue in EclipseLink.

You should be able to use a join or a sub select instead of the special member of syntax.

```<code>SELECT f FROM Foo f left join f.tags t WHERE not(t == :tag)
</code>```

ContentLicense: CC BY-SA 3.0

Body:
Given the following JPA annotated entity classes:

@Entity
@Table("foo")
public class Foo {
    @Id private int id;
    @Column(name="name") private String name;
    @ManyToMany
    @JoinTable(name = "foo_tags",
           joinColumns = {@JoinColumn(name = "foo")},
           inverseJoinColumns = {@JoinColumn(name = "tag")})
    private Collection<Tag> tags;
    ...
}

@Entity
@Table(name = "tag")
public class Tag {
    @Id private String tag;
    ...
}

I'm trying to formulate a query to get all Foo instances that lack a given tag. The following JPQL query does the trick

SELECT f FROM Foo f WHERE :tag NOT MEMBER OF f.tags

However, I'm having trouble translating this into a criteria query. The translation seems obvious (to me):

CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Foo> query = cb.createQuery(Foo.class);
Root<Foo> from = query.from(Foo.class);
query.where(cb.isNotMember(cb.parameter(Tag.class, "tag"), from.get(Foo_.tags)));
TypedQuery<Foo> tq = em.createQuery(query);
return tq.setParameter("tag", sometag).getResultList();

The generated SQL differs significantly in these cases though. The first query generates the following:

SELECT t0.id, t0.name FROM foo t0
WHERE NOT EXISTS (
    SELECT DISTINCT t2.TAG FROM tag t2, foo_tags t1
    WHERE (((t1.foo = t0.id) AND (t2.TAG = t1.tag)) AND ('blue' = t2.TAG)))

while the criteria query generates this:

SELECT t1.id, t1.name FROM tag t0, foo_tags t2, Foo t1
WHERE (NOT ((t0.TAG = 'blue')) AND ((t2.foo = t1.id) AND (t0.TAG = t2.tag)))

I've only tested this using the eclipselink implementation, so possibly there's a problem there, but figured I'd ask here first if anyone spots an obvious mistake.

Body:
The SQL should be the same, although both seem like they would work (minus the empty case).

Please log a bug for the criteria issue in EclipseLink.

You should be able to use a join or a sub select instead of the special member of syntax.

SELECT f FROM Foo f left join f.tags t WHERE not(t == :tag)


问:
Keeping the processes running even after exiting SSH to a windows machine
I am connecting to a remote machine through SSH client. Both SSH server and client are on windows OS.

I usually run tomcat 7 from such ssh session. But, as soon as I end the session, tomcat server shuts down as well. I run tomcat7.exe directly from its installation folder.

I have used &! at the end of the command to ensure that the process doesn't get attached to the terminal. But, couldn't achieve the desired result.
Kindly suggest how to detach such processes from the ssh client.

答:
tomcat7.exe start and tomcat7.exe stop
these two commands ensure that tomcat starts as a service. Worked like a charm for me.


问:
What does str[newLength] = '\0' mean?
I have a question that what does str[newLength] = '\0' mean? because I think the last character should be str[newLength-1], so I don't know the meaning of this line.

Write a method to replace all spaces in a string with '%20'. Assume string has sufficient space at end of string to hold additional characters, and that you're given a true length of a string. I used the books code, implementing the solution in Java using a character array (given the fact that Java Strings are immutable):

```<code>public class Test {
public void replaseSpaces(char[] str, int length) {
    int spaceCount = 0, newLength = 0, i = 0;

    for(i = 0; i < length; i++) {
        if (str[i] == ' ')
            spaceCount++;
    }

    newLength = length + (spaceCount * 2);
    str[newLength] = '\0';
    for(i = length - 1; i >= 0; i--) {
        if (str[i] == ' ') {
            str[newLength - 1] = '0';
            str[newLength - 2] = '2';
            str[newLength - 3] = '%';
            newLength = newLength - 3;
        }
        else {
            str[newLength - 1] = str[i];
            newLength = newLength - 1;
        }
    }
    System.out.println(str);
}
</code>```

答:
```<code>public class StringURLify {

    public static void URLify(String s) {
        char[] c = s.toCharArray();
        int length = s.length();
        int spaceCount = 0, newLength = 0;
        for(int i=0;i<= c.length-1;i++) {
            if(c[i] == ' ') {
                spaceCount++;
            }
        }

        newLength = length + (spaceCount * 2);
        char[] c1 = new char[newLength];

        for(int i=length-1;i>=0;i--) {
            if(c[i] == ' ') {
                c1[newLength - 1] = '0';
                c1[newLength - 2] = '2';
                c1[newLength - 3] = '%';
                newLength = newLength-3;
            } else {
                c1[newLength-1] = c[i];
                newLength = newLength-1;
            }
        }

        System.out.println("URLified string : " + String.valueOf(c1));
    }

    public static void main(String[] args) {
        URLify("the dog left");
    }
}
</code>```

Title: What does str[newLength] = '\0' mean?

Body:
I have a question that what does str[newLength] = '\0' mean? because I think the last character should be str[newLength-1], so I don't know the meaning of this line.

Write a method to replace all spaces in a string with '%20'. Assume string has sufficient space at end of string to hold additional characters, and that you're given a true length of a string. I used the books code, implementing the solution in Java using a character array (given the fact that Java Strings are immutable):

public class Test {
public void replaseSpaces(char[] str, int length) {
    int spaceCount = 0, newLength = 0, i = 0;

    for(i = 0; i < length; i++) {
        if (str[i] == ' ')
            spaceCount++;
    }

    newLength = length + (spaceCount * 2);
    str[newLength] = '\0';
    for(i = length - 1; i >= 0; i--) {
        if (str[i] == ' ') {
            str[newLength - 1] = '0';
            str[newLength - 2] = '2';
            str[newLength - 3] = '%';
            newLength = newLength - 3;
        }
        else {
            str[newLength - 1] = str[i];
            newLength = newLength - 1;
        }
    }
    System.out.println(str);
}


问:
TypeScript type check inline isn't the same as type check in functions
I have a strange (to me at least) issue where type checking inline doesn't work the same way as type checking in a function. The exact same check, doesn't work, when extracted to a function.

I've posted a screenshot so you can see the errors, and a link to same code on Code Sandbox.

I first had the issue in IntelliJ but made this isolated issue in CodeSandbox (Visual Studio Code), so I guess the issue is TypeScript.

Do you have any idea why this is happening?

答:
That's because you need to implement a "type guard":

```<code>const isPromise = (maybePromise: unknown): maybePromise is Promise<unknown> => {
  return (
    typeof maybePromise === "object" &&
    typeof (maybePromise as Promise<unknown>).then === "function"
  );
};

// Util to tell if argument is a String
const isString = (maybeString: unknown): maybeString is string => {
  return typeof maybeString === "string";
};
</code>```

maybePromise is Promise<unknown> and maybeString is string will guarantee the type in the scope.

Here is a working example: https://stackblitz.com/edit/typescript-8ilugj

Body:
That's because you need to implement a "type guard":

const isPromise = (maybePromise: unknown): maybePromise is Promise<unknown> => {
  return (
    typeof maybePromise === "object" &&
    typeof (maybePromise as Promise<unknown>).then === "function"
  );
};

// Util to tell if argument is a String
const isString = (maybeString: unknown): maybeString is string => {
  return typeof maybeString === "string";
};

maybePromise is Promise<unknown> and maybeString is string will guarantee the type in the scope.

Here is a working example: https://stackblitz.com/edit/typescript-8ilugj


问:
manual object constructor call
Can you please tell me if it is possible to call object constructor manually? I know it's wrong and I would never do something like that in my own code and I know I can fix this problem by creating and calling initialization function, however the problem is that I stumbled at a case where there are thousands of lines of code in object's and its parents' constructors...

```<code>class MyClass()
{
    MyClass() { }
    virtual ~MyClass();

    void reset()
    {
         this->~MyClass();
         this->MyClass::MyClass(); //error: Invalid use of MyClass
    }
};
</code>```

答:
You could use placement new syntax:</p>

```<code>this->~MyClass(); // destroy
new(this) CMyClass(); // construct at the same address
</code>```

Title: manual object constructor call

Body:
Can you please tell me if it is possible to call object constructor manually? I know it's wrong and I would never do something like that in my own code and I know I can fix this problem by creating and calling initialization function, however the problem is that I stumbled at a case where there are thousands of lines of code in object's and its parents' constructors...

class MyClass()
{
    MyClass() { }
    virtual ~MyClass();

    void reset()
    {
         this->~MyClass();
         this->MyClass::MyClass(); //error: Invalid use of MyClass
    }
};

Body:
You could use placement new syntax:

this->~MyClass(); // destroy
new(this) CMyClass(); // construct at the same address


问:
How I get to know that i back from other app in swift
Actually i am opening other app from my app and than after when i come back to my app using top left button.

So here i want to know is there any way to identify that i came back from other app so i will put condition on it.

After back to my app there is two method of appDelegate is called.

```<code>func applicationWillEnterForeground(_ application: UIApplication)

func applicationDidBecomeActive(_ application: UIApplication)
</code>```

But I want any particular condition to put here to get to know about it.

As many down vote this question. I want to add as when i back from other app my app goes black.

So for this reason i want to check it and if it's from other app i will assign view again to controller.

Thank you in advance.

```<code>func applicationDidBecomeActive(_ application: UIApplication) {
    if someCondition {
        print("Coming back from another application")
    } else {
        print("Coming back from app switcher/home")
    }
}
</code>```

答:
Just adding the comment as answer:

Declare a global bool variable, something like var openingAnotherApp = false

Now when you open another app, before opening it, make your openingAnotherApp = true .

Now in your AppDelegate, you can check if openingAnotherApp is true or false. And then again change it value back to false after your condition check completes.

Body:
Actually i am opening other app from my app and than after when i come back to my app using top left button.

So here i want to know is there any way to identify that i came back from other app so i will put condition on it.

After back to my app there is two method of appDelegate is called.

func applicationWillEnterForeground(_ application: UIApplication)

func applicationDidBecomeActive(_ application: UIApplication)

But I want any particular condition to put here to get to know about it.

As many down vote this question. I want to add as when i back from other app my app goes black.

So for this reason i want to check it and if it's from other app i will assign view again to controller.

Thank you in advance.

func applicationDidBecomeActive(_ application: UIApplication) {
    if someCondition {
        print("Coming back from another application")
    } else {
        print("Coming back from app switcher/home")
    }
}


问:
java throw new NoSuchElementException build failed with arraylist
I'm coding a stack implementation using Arraylist. I'm trying to use NoSuchElementException when it tries to pop when the array is empty but I get a build error message and I have no idea what is going on. Here is the output I'm getting:

```<code>please enter your number:

1 f
*********************Stack ArrayList Implementation*********************
false
1
1
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
    at java.util.ArrayList.elementData(ArrayList.java:422)
    at java.util.ArrayList.get(ArrayList.java:435)
    at StackUsingArrayList.peek(StackUsingArrayList.java:42)
    at StackUsingArrayList.main(StackUsingArrayList.java:74)
C:\Users\alsrb\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 4 seconds)
</code>```

this part seems to be the problem and the funny thing is if I don't use exception throws, it works just fine.

```<code>int pop() {
if (!isEmpty()) { // checks for an empty Stack
      int popValue = stackList.get(stackList.size() - 1);
      stackList.remove(stackList.size() - 1); // removes the poped element
      return popValue;
} else {
    throw new NoSuchElementException();
    //System.out.print("The stack is already empty  ");
    //return -1;
}
}
</code>```

Somebody please help me.
here's my whole code

```<code>import java.util.ArrayList;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class StackUsingArrayList{
Scanner scanner = new Scanner(System.in);

ArrayList<Integer> stackList;

StackUsingArrayList() {
    stackList = new ArrayList<>();
}

void push(int v) {
    stackList.add(v);
}

int pop() {
    if (!isEmpty()) { // checks for an empty Stack
          int popValue = stackList.get(stackList.size() - 1);
          stackList.remove(stackList.size() - 1); // removes the poped element
          return popValue;
    } else {
        throw new NoSuchElementException();
        //System.out.print("The stack is already empty  ");
        //return -1;
    }
}

boolean isEmpty() {
    if (stackList.get(0) == null){
        return true;
    } else {
        return false;
    }
}

int peek() {
    return stackList.get(stackList.size() - 1);
}

int size(){
    int i = 0;
    while(stackList != null){
        stackList.get(i);
        i++;
    }
return i;
}

public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    StackUsingArrayList myStack = new StackUsingArrayList();

    System.out.println("Please enter your number: ");

    while(scanner.hasNextInt()){
        int x = scanner.nextInt();
        if(x >= 0){
        myStack.push(x);
        }
    }

    System.out.println("*********************Stack ArrayList Implementation*********************");
    System.out.println(myStack.isEmpty());
    System.out.println(myStack.peek());
    System.out.println(myStack.pop());
    System.out.println(myStack.peek());
    System.out.println(myStack.pop());
    System.out.println(myStack.peek());
    System.out.println(myStack.pop());
}
}
</code>```

答:
Your isEmpty() implementation is wrong. If stackList is empty, stackList.get(0) will throw an exception.

Simply use stackList.isEmpty().

```<code>boolean isEmpty() {
    return stackList.isEmpty();
}
</code>```

Body:
I'm coding a stack implementation using Arraylist. I'm trying to use NoSuchElementException when it tries to pop when the array is empty but I get a build error message and I have no idea what is going on. Here is the output I'm getting:

please enter your number:

1 f
*********************Stack ArrayList Implementation*********************
false
1
1
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
    at java.util.ArrayList.elementData(ArrayList.java:422)
    at java.util.ArrayList.get(ArrayList.java:435)
    at StackUsingArrayList.peek(StackUsingArrayList.java:42)
    at StackUsingArrayList.main(StackUsingArrayList.java:74)
C:\Users\alsrb\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 4 seconds)

this part seems to be the problem and the funny thing is if I don't use exception throws, it works just fine.

int pop() {
if (!isEmpty()) { // checks for an empty Stack
      int popValue = stackList.get(stackList.size() - 1);
      stackList.remove(stackList.size() - 1); // removes the poped element
      return popValue;
} else {
    throw new NoSuchElementException();
    //System.out.print("The stack is already empty  ");
    //return -1;
}
}

Somebody please help me.
here's my whole code

import java.util.ArrayList;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class StackUsingArrayList{
Scanner scanner = new Scanner(System.in);

ArrayList<Integer> stackList;

StackUsingArrayList() {
    stackList = new ArrayList<>();
}

void push(int v) {
    stackList.add(v);
}

int pop() {
    if (!isEmpty()) { // checks for an empty Stack
          int popValue = stackList.get(stackList.size() - 1);
          stackList.remove(stackList.size() - 1); // removes the poped element
          return popValue;
    } else {
        throw new NoSuchElementException();
        //System.out.print("The stack is already empty  ");
        //return -1;
    }
}

boolean isEmpty() {
    if (stackList.get(0) == null){
        return true;
    } else {
        return false;
    }
}

int peek() {
    return stackList.get(stackList.size() - 1);
}

int size(){
    int i = 0;
    while(stackList != null){
        stackList.get(i);
        i++;
    }
return i;
}

public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    StackUsingArrayList myStack = new StackUsingArrayList();

    System.out.println("Please enter your number: ");

    while(scanner.hasNextInt()){
        int x = scanner.nextInt();
        if(x >= 0){
        myStack.push(x);
        }
    }

    System.out.println("*********************Stack ArrayList Implementation*********************");
    System.out.println(myStack.isEmpty());
    System.out.println(myStack.peek());
    System.out.println(myStack.pop());
    System.out.println(myStack.peek());
    System.out.println(myStack.pop());
    System.out.println(myStack.peek());
    System.out.println(myStack.pop());
}
}

Body:
Your isEmpty() implementation is wrong. If stackList is empty, stackList.get(0) will throw an exception.

Simply use stackList.isEmpty().

boolean isEmpty() {
    return stackList.isEmpty();
}