问:
NoSuchMethodError: org.springframework.data.util.TypeInformation.isSubTypeOf(Ljava/lang/Class;)Z
I am using Spring Data Elasticsearch with Elasticsearch version 7.4.
Maven:

```<code>    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
        <version>2.1.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-elasticsearch</artifactId>
        <version>4.0.0.BUILD-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-commons</artifactId>
        <version>2.1.10.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>7.4.0</version>
    </dependency>
    <dependency>
        <groupId>org.elasticsearch.client</groupId>
        <artifactId>elasticsearch-rest-high-level-client</artifactId>
        <version>7.4.0</version>
    </dependency>
    <dependency>
        <groupId>org.elasticsearch.client</groupId>
        <artifactId>elasticsearch-rest-client</artifactId>
        <version>7.4.0</version>
    </dependency>
</code>```

Model

```<code>@AllArgsConstructor
@NoArgsConstructor
@Data
@Document(indexName = "address", createIndex = true)
public class Address {
    @Id
    private String id;
    private String fullAddress;

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

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Entry {
    private String aoid;
    private String aoGuid;
    private String code;
    private String offName;
    private String parentGuid;
    private String shortName;
    @Field(type = FieldType.Integer)
    private Integer aoLevel;
    private String postalCode;
}
</code>```

Repository:

```<code>@Repository
public interface AddressElasticRepository extends ElasticsearchRepository<Address, String> {
    List<Address> findByFullAddressContains(String fullAddress);
}
</code>```

Service

```<code>@Service
public class SearchServiceImpl implements SearchService {
    private final AddressElasticRepository addressElasticRepository;

    public SearchServiceImpl(AddressElasticRepository addressElasticRepository) {
        this.addressElasticRepository = addressElasticRepository;
    }

    @Override
    public List<Document> search(String query) {
        List<Address> all = addressElasticRepository.findByFullAddressContains(query);
        all.forEach(it -> log.info("-- " + it.getFullAddress()));

        return null;
    }

    @Override
    public void save(Address address) {
        addressElasticRepository.save(address);
    }
}
</code>```

Controller:

```<code>@Controller
public class SearchController {
    private final SearchService searchService;

    public SearchController(SearchService searchService) {
        this.searchService = searchService;
    }

    @RequestMapping(value = "/api/v1/fias/search", method = GET)
    public List<Document> search(@RequestParam String query) {
        return searchService.search(query);
    }
}
</code>```

When I do a search: localhost:8189/api/v1/fias/search?query=Moscow I get an error:

java.lang.NoSuchMethodError:
  org.springframework.data.util.TypeInformation.isSubTypeOf(Ljava/lang/Class;)Z

The error occurs on the line (SearchServiceImpl.java:23): List  all = addressElasticRepository.findByFullAddressContains (query);

How to fix it?

UPD: Full StackTrace

java.lang.NoSuchMethodError:
  org.springframework.data.util.TypeInformation.isSubTypeOf(Ljava/lang/Class;)Z
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.createCollectionForValue(MappingElasticsearchConverter.java:675)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.readCollectionValue(MappingElasticsearchConverter.java:362)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.readValue(MappingElasticsearchConverter.java:345)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter$ElasticsearchPropertyValueProvider.getPropertyValue(MappingElasticsearchConverter.java:876)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.readProperties(MappingElasticsearchConverter.java:319)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.readEntity(MappingElasticsearchConverter.java:267)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.read(MappingElasticsearchConverter.java:247)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.mapDocument(MappingElasticsearchConverter.java:220)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.read(MappingElasticsearchConverter.java:188)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.lambda$read$1(MappingElasticsearchConverter.java:169)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
  ~[na:1.8.0_201]   at
  java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
  ~[na:1.8.0_201]   at
  java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
  ~[na:1.8.0_201]   at
  java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
  ~[na:1.8.0_201]   at
  java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
  ~[na:1.8.0_201]   at
  java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
  ~[na:1.8.0_201]   at
  java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
  ~[na:1.8.0_201]   at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.read(MappingElasticsearchConverter.java:170)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.search(ElasticsearchRestTemplate.java:244)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.repository.query.ElasticsearchPartQuery.execute(ElasticsearchPartQuery.java:106)
  ~[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.$Proxy120.findByFullAddressContains(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.$Proxy120.findByFullAddressContains(Unknown Source)
  ~[na:na]  at
  ru.evolenta.server.service.impl.SearchServiceImpl.search(SearchServiceImpl.java:23)
  ~[classes/:na]    at
  ru.evolenta.server.controller.SearchController.search(SearchController.java:27)
  ~[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]

UPD 2: Error in spring-data-commons version. The isSubTypeOf method appeared after version 2.2. If I upgrade, the application does not start, here is the stack trace:

java.lang.NoSuchFieldError: IMPORT_BEAN_NAME_GENERATOR    at
  org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport.registerBeanDefinitions(RepositoryBeanDefinitionRegistrarSupport.java:78)
  ~[spring-data-commons-2.2.1.RELEASE.jar:2.2.1.RELEASE]    at
  org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda$loadBeanDefinitionsFromRegistrars$0(ConfigurationClassBeanDefinitionReader.java:360)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
  ~[na:1.8.0_201]   at
  org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:359)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:144)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:117)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:328)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:693)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
  ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]    at
  org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)
  [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]     at
  org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388)
  [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]     at
  org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
  [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]     at
  org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)
  [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]     at
  org.springframework.boot.SpringApplication.run(SpringApplication.java:1234)
  [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]     at
  ru.evolenta.server.CoreFiasApplication.main(CoreFiasApplication.java:21)
  [classes/:na]

答:
I think the problem in your code is:

```<code>@Repository
public interface AddressElasticRepository extends ElasticsearchRepository<Address, String> {
    List<Address> findByFullAddressContains(String fullAddress);
}
</code>```

Try it without Contains and then with Containing(instead of Contains).

Please see the Spring Data Elasticsearch Query Creation and Spring Data JPA Query Creation documentations.

Body:
I am using Spring Data Elasticsearch with Elasticsearch version 7.4.
Maven:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
        <version>2.1.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-elasticsearch</artifactId>
        <version>4.0.0.BUILD-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-commons</artifactId>
        <version>2.1.10.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>7.4.0</version>
    </dependency>
    <dependency>
        <groupId>org.elasticsearch.client</groupId>
        <artifactId>elasticsearch-rest-high-level-client</artifactId>
        <version>7.4.0</version>
    </dependency>
    <dependency>
        <groupId>org.elasticsearch.client</groupId>
        <artifactId>elasticsearch-rest-client</artifactId>
        <version>7.4.0</version>
    </dependency>

Model

@AllArgsConstructor
@NoArgsConstructor
@Data
@Document(indexName = "address", createIndex = true)
public class Address {
    @Id
    private String id;
    private String fullAddress;

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

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Entry {
    private String aoid;
    private String aoGuid;
    private String code;
    private String offName;
    private String parentGuid;
    private String shortName;
    @Field(type = FieldType.Integer)
    private Integer aoLevel;
    private String postalCode;
}

Repository:

@Repository
public interface AddressElasticRepository extends ElasticsearchRepository<Address, String> {
    List<Address> findByFullAddressContains(String fullAddress);
}

Service

@Service
public class SearchServiceImpl implements SearchService {
    private final AddressElasticRepository addressElasticRepository;

    public SearchServiceImpl(AddressElasticRepository addressElasticRepository) {
        this.addressElasticRepository = addressElasticRepository;
    }

    @Override
    public List<Document> search(String query) {
        List<Address> all = addressElasticRepository.findByFullAddressContains(query);
        all.forEach(it -> log.info("-- " + it.getFullAddress()));

        return null;
    }

    @Override
    public void save(Address address) {
        addressElasticRepository.save(address);
    }
}

Controller:

@Controller
public class SearchController {
    private final SearchService searchService;

    public SearchController(SearchService searchService) {
        this.searchService = searchService;
    }

    @RequestMapping(value = "/api/v1/fias/search", method = GET)
    public List<Document> search(@RequestParam String query) {
        return searchService.search(query);
    }
}

When I do a search: localhost:8189/api/v1/fias/search?query=Moscow I get an error:

java.lang.NoSuchMethodError:
  org.springframework.data.util.TypeInformation.isSubTypeOf(Ljava/lang/Class;)Z

The error occurs on the line (SearchServiceImpl.java:23): List  all = addressElasticRepository.findByFullAddressContains (query);

How to fix it?

UPD: Full StackTrace

java.lang.NoSuchMethodError:
  org.springframework.data.util.TypeInformation.isSubTypeOf(Ljava/lang/Class;)Z
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.createCollectionForValue(MappingElasticsearchConverter.java:675)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.readCollectionValue(MappingElasticsearchConverter.java:362)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.readValue(MappingElasticsearchConverter.java:345)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter$ElasticsearchPropertyValueProvider.getPropertyValue(MappingElasticsearchConverter.java:876)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.readProperties(MappingElasticsearchConverter.java:319)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.readEntity(MappingElasticsearchConverter.java:267)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.read(MappingElasticsearchConverter.java:247)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.mapDocument(MappingElasticsearchConverter.java:220)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.read(MappingElasticsearchConverter.java:188)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.lambda$read$1(MappingElasticsearchConverter.java:169)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
  ~[na:1.8.0_201]   at
  java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
  ~[na:1.8.0_201]   at
  java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
  ~[na:1.8.0_201]   at
  java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
  ~[na:1.8.0_201]   at
  java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
  ~[na:1.8.0_201]   at
  java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
  ~[na:1.8.0_201]   at
  java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
  ~[na:1.8.0_201]   at
  org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter.read(MappingElasticsearchConverter.java:170)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.search(ElasticsearchRestTemplate.java:244)
  ~[spring-data-elasticsearch-4.0.0.BUILD-20200217.043541-321.jar:4.0.0.BUILD-SNAPSHOT]
    at
  org.springframework.data.elasticsearch.repository.query.ElasticsearchPartQuery.execute(ElasticsearchPartQuery.java:106)
  ~[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.$Proxy120.findByFullAddressContains(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.$Proxy120.findByFullAddressContains(Unknown Source)
  ~[na:na]  at
  ru.evolenta.server.service.impl.SearchServiceImpl.search(SearchServiceImpl.java:23)
  ~[classes/:na]    at
  ru.evolenta.server.controller.SearchController.search(SearchController.java:27)
  ~[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]

UPD 2: Error in spring-data-commons version. The isSubTypeOf method appeared after version 2.2. If I upgrade, the application does not start, here is the stack trace:

java.lang.NoSuchFieldError: IMPORT_BEAN_NAME_GENERATOR    at
  org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport.registerBeanDefinitions(RepositoryBeanDefinitionRegistrarSupport.java:78)
  ~[spring-data-commons-2.2.1.RELEASE.jar:2.2.1.RELEASE]    at
  org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda$loadBeanDefinitionsFromRegistrars$0(ConfigurationClassBeanDefinitionReader.java:360)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
  ~[na:1.8.0_201]   at
  org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:359)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:144)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:117)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:328)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:693)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
  ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]     at
  org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
  ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]    at
  org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)
  [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]     at
  org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388)
  [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]     at
  org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
  [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]     at
  org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)
  [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]     at
  org.springframework.boot.SpringApplication.run(SpringApplication.java:1234)
  [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]     at
  ru.evolenta.server.CoreFiasApplication.main(CoreFiasApplication.java:21)
  [classes/:na]

Body:
I think the problem in your code is:

@Repository
public interface AddressElasticRepository extends ElasticsearchRepository<Address, String> {
    List<Address> findByFullAddressContains(String fullAddress);
}

Try it without Contains and then with Containing(instead of Contains).

Please see the Spring Data Elasticsearch Query Creation and Spring Data JPA Query Creation documentations.


来源: stackexchange

问:
problem in the output of query - php+json
```<code>function tableOne() {

        $query = mysql_query("SELECT valor FROM grafico") or die(mysql_error());
        $i = 0;
        while($row = mysql_fetch_assoc($query)) {
            $arr[] = array($row[valor]);
            ++$i;
        }
        echo json_encode($arr);
    }
}
</code>```

the output will be

[["15573"],["31978"],["11227"],["5752"],["20817"],["32182"]]

i need something like:

```<code>["15573","31978","11227","5752","20817","32182","10935"]
</code>```

i tried some changes in the code but the output is not what i want.

thanks

答:
You are placing sub-arrays in each element of your array.  You should replace

```<code>$arr[] = array($row[valor]);
</code>```

with

```<code>$arr[] = $row[valor];
</code>```

The [] in $arr[] already adds each entry as an element of the array.

ContentLicense: CC BY-SA 3.0

Body:
function tableOne() {

        $query = mysql_query("SELECT valor FROM grafico") or die(mysql_error());
        $i = 0;
        while($row = mysql_fetch_assoc($query)) {
            $arr[] = array($row[valor]);
            ++$i;
        }
        echo json_encode($arr);
    }
}

the output will be

[["15573"],["31978"],["11227"],["5752"],["20817"],["32182"]]

i need something like:

["15573","31978","11227","5752","20817","32182","10935"]

i tried some changes in the code but the output is not what i want.

thanks

Body:
You are placing sub-arrays in each element of your array.  You should replace

$arr[] = array($row[valor]);

with

$arr[] = $row[valor];

The [] in $arr[] already adds each entry as an element of the array.


问:
Some Nunit tests are failing in groups but pass when run individually in other env
I have been trying to hit a Web controller directly to upload csv files using Nunit, Specflow and Restsharp but the tests are failing in groups but passes when individually. Another thing which we noticed is these are working fine locally as in running the app as localhost but not in other env. All other test groups are passing in that env. I have seen couple of posts which suggested not to use static properties to store values but i have tried that as well. we also added delay between threads but thats not working either

please can anyone help on this one or anyone who have faced this?
The error I am getting is timeout. if you accces it from the browser then there are no issues

I am using context injection to pass values from one another in step def file.
Here is what the code looks like

```<code>public (IRestResponse response,string RVtoken) GetRVtoken()
        {
            var client = new RestClient(ConfigurationManager.AppSettings["Web_URL"] +"Account/SignIn");
            var request = new RestRequest(Method.GET);
            IRestResponse response = client.Execute(request);
            var html = new HtmlDocument();
            html.LoadHtml(response.Content.ToString());
            var RVtoken = html.DocumentNode.SelectSingleNode("/html[1]/body[1]/div[1]/div[1]/form[1]/input[1]/@value[1]").Attributes["value"].Value;
            return (response, RVtoken);
        }

public (CookieContainer cookieContainer, Uri target) GetAspxAuthToken(string email,string password, IRestResponse SignInResponse, string RVtoken)
        {
            string ReturnUrl = ConfigurationManager.AppSettings["Web_URL"] + "Account/SignIn?ReturnUrl=%2F";
            var client = new RestClient(ReturnUrl);
            CookieContainer cookieContainer = new CookieContainer();
            HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(ReturnUrl);
            httpRequest.CookieContainer = cookieContainer;
            httpRequest.Method = Method.POST.ToString();
            string postData = string.Format("Email={0}&Password={1}&__RequestVerificationToken={2}&RememberMe=false", email, password, RVtoken);
            byte[] byteArray = Encoding.UTF8.GetBytes(postData);
            httpRequest.ContentType = "application/x-www-form-urlencoded";
            httpRequest.ContentLength = byteArray.Length;
            Uri target = new Uri(ReturnUrl);
            httpRequest.CookieContainer.Add(new Cookie(SignInResponse.Cookies[0].Name, SignInResponse.Cookies[0].Value) { Domain = target.Host });
            httpRequest.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
            Stream dataStream = httpRequest.GetRequestStream();
            dataStream.Write(byteArray, 0, byteArray.Length);
            HttpWebResponse myresponse = (HttpWebResponse)httpRequest.GetResponse();
            return (cookieContainer,target);

        }

public IRestResponse Uploadflex(string flexType,string filepath,IRestResponse SignInResponse)
        {
            RestClient newclient = newclient = new RestClient(ConfigurationManager.AppSettings["Web_URL"] + "audiences/" + flexType + "/upload?utc=1580117555355");
            var newrequests = new RestRequest(Method.POST);
            newrequests.AddFile("targetAreaFile",filepath);
            newrequests.AddCookie(SignInResponse.Cookies[0].Name, SignInResponse.Cookies[0].Value);
            newrequests.AddCookie(User.cookieContainer.GetCookies(User.target)[".aspxauth"].Name.ToString(), User.cookieContainer.GetCookies(User.target)[".aspxauth"].Value.ToString());
            newrequests.AddParameter("name", "targetAreaFile");
            newrequests.AddParameter("Content-Type", "application/vnd.ms-excel");
            newrequests.AddParameter("Content-Disposition", "form-data");
            var response = newclient.Execute(newrequests);
            return response;
        }
</code>```

答: ok, so the issue was I was creating differnet sessions for these tests but somehow cookies were not clearing so I put all the tests under same session and it works magically.</p>

ContentLicense: CC BY-SA 4.0

Body:
I have been trying to hit a Web controller directly to upload csv files using Nunit, Specflow and Restsharp but the tests are failing in groups but passes when individually. Another thing which we noticed is these are working fine locally as in running the app as localhost but not in other env. All other test groups are passing in that env. I have seen couple of posts which suggested not to use static properties to store values but i have tried that as well. we also added delay between threads but thats not working either

please can anyone help on this one or anyone who have faced this?
The error I am getting is timeout. if you accces it from the browser then there are no issues

I am using context injection to pass values from one another in step def file.
Here is what the code looks like

public (IRestResponse response,string RVtoken) GetRVtoken()
        {
            var client = new RestClient(ConfigurationManager.AppSettings["Web_URL"] +"Account/SignIn");
            var request = new RestRequest(Method.GET);
            IRestResponse response = client.Execute(request);
            var html = new HtmlDocument();
            html.LoadHtml(response.Content.ToString());
            var RVtoken = html.DocumentNode.SelectSingleNode("/html[1]/body[1]/div[1]/div[1]/form[1]/input[1]/@value[1]").Attributes["value"].Value;
            return (response, RVtoken);
        }

public (CookieContainer cookieContainer, Uri target) GetAspxAuthToken(string email,string password, IRestResponse SignInResponse, string RVtoken)
        {
            string ReturnUrl = ConfigurationManager.AppSettings["Web_URL"] + "Account/SignIn?ReturnUrl=%2F";
            var client = new RestClient(ReturnUrl);
            CookieContainer cookieContainer = new CookieContainer();
            HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(ReturnUrl);
            httpRequest.CookieContainer = cookieContainer;
            httpRequest.Method = Method.POST.ToString();
            string postData = string.Format("Email={0}&Password={1}&__RequestVerificationToken={2}&RememberMe=false", email, password, RVtoken);
            byte[] byteArray = Encoding.UTF8.GetBytes(postData);
            httpRequest.ContentType = "application/x-www-form-urlencoded";
            httpRequest.ContentLength = byteArray.Length;
            Uri target = new Uri(ReturnUrl);
            httpRequest.CookieContainer.Add(new Cookie(SignInResponse.Cookies[0].Name, SignInResponse.Cookies[0].Value) { Domain = target.Host });
            httpRequest.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
            Stream dataStream = httpRequest.GetRequestStream();
            dataStream.Write(byteArray, 0, byteArray.Length);
            HttpWebResponse myresponse = (HttpWebResponse)httpRequest.GetResponse();
            return (cookieContainer,target);

        }

public IRestResponse Uploadflex(string flexType,string filepath,IRestResponse SignInResponse)
        {
            RestClient newclient = newclient = new RestClient(ConfigurationManager.AppSettings["Web_URL"] + "audiences/" + flexType + "/upload?utc=1580117555355");
            var newrequests = new RestRequest(Method.POST);
            newrequests.AddFile("targetAreaFile",filepath);
            newrequests.AddCookie(SignInResponse.Cookies[0].Name, SignInResponse.Cookies[0].Value);
            newrequests.AddCookie(User.cookieContainer.GetCookies(User.target)[".aspxauth"].Name.ToString(), User.cookieContainer.GetCookies(User.target)[".aspxauth"].Value.ToString());
            newrequests.AddParameter("name", "targetAreaFile");
            newrequests.AddParameter("Content-Type", "application/vnd.ms-excel");
            newrequests.AddParameter("Content-Disposition", "form-data");
            var response = newclient.Execute(newrequests);
            return response;
        }


问:
tidyr Pivot-wider: Duplicate issue
I am trying to use pivot wider to reduce the number of rows in my data and add new columns. However, the number of columns increases, but the number of rows remains the same. Ideally, each 'Indicator' should be one observation, where the DataYear, Company, Market, Country etc columns are the same. I think the issue may be due to duplicate observations, but dont understand how the IndicatorID column doesnt fix this issue?

A sample of my data:

```<code>    LongTest <- structure(list(DataYear = c(2018L, 2017L, 2016L, 2018L, 2017L,
2016L, 2018L, 2017L, 2016L), Company = structure(c(1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L), .Label = "One", class = "factor"), Market = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "Total", class = "factor"),
    Country = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "ALL", class = "factor"),
    ISO = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "ALL", class = "factor"),
    Sector = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "Insurance", class = "factor"),
    Division = c(NA, NA, NA, NA, NA, NA, NA, NA, NA), Furtherdetails1 = c(NA,
    NA, NA, NA, NA, NA, NA, NA, NA), Furtherdetails2 = c(NA,
    NA, NA, NA, NA, NA, NA, NA, NA), Indicator = structure(c(1L,
    1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L), .Label = c("Tax Avoidance",
    "Turnover"), class = "factor"), IndicatorID = c(20L, 20L,
    20L, 20L, 20L, 20L, 26L, 26L, 26L), InputName = structure(c(3L,
    3L, 3L, 2L, 2L, 2L, 1L, 1L, 1L), .Label = c("Number of employees",
    "Profit before tax (Attributable to shareholder profit)",
    "Tax Paid"), class = "factor"), InputCode = structure(c(2L,
    2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L), .Label = c("InputA", "InputB"
    ), class = "factor"), UnitRequired = structure(c(2L, 2L,
    2L, 2L, 2L, 2L, 1L, 1L, 1L), .Label = c("#", "GBP"), class = "factor"),
    Value = c(4.47e+08, 6.2e+08, 6.47e+08, 2.129e+09, 2.003e+09,
    1.193e+09, 37628, 42431, 39833.44), UniqueID = 1:9), class = "data.frame", row.names = c(NA,
-9L))
</code>```

And the code I am currently using:

```<code>outTest <- pivot_wider(LongTest, names_from = InputCode, values_from = c(Value, UnitRequired, InputName))
</code>```

When I use my full dataframe I get this error message:

```<code>Warning messages:
1: Values in `InputName` are not uniquely identified; output will contain list-cols.
* Use `values_fn = list(InputName = list)` to suppress this warning.
* Use `values_fn = list(InputName = length)` to identify where the duplicates arise
* Use `values_fn = list(InputName = summary_fun)` to summarise duplicates
2: Values in `UnitRequired` are not uniquely identified; output will contain list-cols.
* Use `values_fn = list(UnitRequired = list)` to suppress this warning.
* Use `values_fn = list(UnitRequired = length)` to identify where the duplicates arise
* Use `values_fn = list(UnitRequired = summary_fun)` to summarise duplicates
3: Values in `Value` are not uniquely identified; output will contain list-cols.
* Use `values_fn = list(Value = list)` to suppress this warning.
* Use `values_fn = list(Value = length)` to identify where the duplicates arise
* Use `values_fn = list(Value = summary_fun)` to summarise duplicates
</code>```

Ideal output would be something like this:

```<code>    structure(list(DataYear = c(2018L, 2017L, 2016L, 2018L, 2017L,
2016L), Company = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = "One", class = "factor"),
    Market = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = "Total", class = "factor"),
    Country = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = "ALL", class = "factor"),
    ISO = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = "ALL", class = "factor"),
    Sector = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = "Insurance", class = "factor"),
    Division = c(NA, NA, NA, NA, NA, NA), Furtherdetails1 = c(NA,
    NA, NA, NA, NA, NA), Furtherdetails2 = c(NA, NA, NA, NA,
    NA, NA), Indicator = structure(c(1L, 1L, 1L, 2L, 2L, 2L), .Label = c("Tax Avoidance",
    "Turnover"), class = "factor"), IndicatorID = c(20L, 20L,
    20L, 26L, 26L, 26L), Value_InputA = c(2129000000L, 2003000000L,
    1193000000L, NA, NA, NA), InputName_InputA = structure(c(2L,
    2L, 2L, 1L, 1L, 1L), .Label = c("", "Profit before tax (Attributable to shareholder profit)"
    ), class = "factor"), UnitRequired_InputA = structure(c(2L,
    2L, 2L, 1L, 1L, 1L), .Label = c("", "GBP"), class = "factor"),
    Value_InputB = c(4.47e+08, 6.2e+08, 6.47e+08, 37628, 42431,
    39833.44), InputName_InputB = structure(c(2L, 2L, 2L, 1L,
    1L, 1L), .Label = c("Number of employees", "Tax Paid"), class = "factor"),
    UnitRequired_InputB = structure(c(2L, 2L, 2L, 1L, 1L, 1L), .Label = c("#",
    "GBP"), class = "factor")), class = "data.frame", row.names = c(NA,
-6L))
</code>```

Any help would be greatly appreciated!

Thanks

答:
Using @Ronak Shah's suggestion in his comment to create a row column, the following seems to do it. I have added a second grouping column, Indicator.

```<code>library(tidyverse)

LongTest %>%
  group_by(InputCode, Indicator) %>%
  mutate(row = row_number()) %>%
  pivot_wider(id_cols = c(row, Indicator),
              names_from = InputCode,
              values_from = c(Value, UnitRequired, InputName)) %>%
  select(-row)
</code>```

Title: tidyr Pivot-wider: Duplicate issue

Body:
I am trying to use pivot wider to reduce the number of rows in my data and add new columns. However, the number of columns increases, but the number of rows remains the same. Ideally, each 'Indicator' should be one observation, where the DataYear, Company, Market, Country etc columns are the same. I think the issue may be due to duplicate observations, but dont understand how the IndicatorID column doesnt fix this issue?

A sample of my data:

    LongTest <- structure(list(DataYear = c(2018L, 2017L, 2016L, 2018L, 2017L,
2016L, 2018L, 2017L, 2016L), Company = structure(c(1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L), .Label = "One", class = "factor"), Market = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "Total", class = "factor"),
    Country = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "ALL", class = "factor"),
    ISO = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "ALL", class = "factor"),
    Sector = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "Insurance", class = "factor"),
    Division = c(NA, NA, NA, NA, NA, NA, NA, NA, NA), Furtherdetails1 = c(NA,
    NA, NA, NA, NA, NA, NA, NA, NA), Furtherdetails2 = c(NA,
    NA, NA, NA, NA, NA, NA, NA, NA), Indicator = structure(c(1L,
    1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L), .Label = c("Tax Avoidance",
    "Turnover"), class = "factor"), IndicatorID = c(20L, 20L,
    20L, 20L, 20L, 20L, 26L, 26L, 26L), InputName = structure(c(3L,
    3L, 3L, 2L, 2L, 2L, 1L, 1L, 1L), .Label = c("Number of employees",
    "Profit before tax (Attributable to shareholder profit)",
    "Tax Paid"), class = "factor"), InputCode = structure(c(2L,
    2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L), .Label = c("InputA", "InputB"
    ), class = "factor"), UnitRequired = structure(c(2L, 2L,
    2L, 2L, 2L, 2L, 1L, 1L, 1L), .Label = c("#", "GBP"), class = "factor"),
    Value = c(4.47e+08, 6.2e+08, 6.47e+08, 2.129e+09, 2.003e+09,
    1.193e+09, 37628, 42431, 39833.44), UniqueID = 1:9), class = "data.frame", row.names = c(NA,
-9L))

And the code I am currently using:

outTest <- pivot_wider(LongTest, names_from = InputCode, values_from = c(Value, UnitRequired, InputName))

When I use my full dataframe I get this error message:

Warning messages:
1: Values in `InputName` are not uniquely identified; output will contain list-cols.
* Use `values_fn = list(InputName = list)` to suppress this warning.
* Use `values_fn = list(InputName = length)` to identify where the duplicates arise
* Use `values_fn = list(InputName = summary_fun)` to summarise duplicates
2: Values in `UnitRequired` are not uniquely identified; output will contain list-cols.
* Use `values_fn = list(UnitRequired = list)` to suppress this warning.
* Use `values_fn = list(UnitRequired = length)` to identify where the duplicates arise
* Use `values_fn = list(UnitRequired = summary_fun)` to summarise duplicates
3: Values in `Value` are not uniquely identified; output will contain list-cols.
* Use `values_fn = list(Value = list)` to suppress this warning.
* Use `values_fn = list(Value = length)` to identify where the duplicates arise
* Use `values_fn = list(Value = summary_fun)` to summarise duplicates

Ideal output would be something like this:

    structure(list(DataYear = c(2018L, 2017L, 2016L, 2018L, 2017L,
2016L), Company = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = "One", class = "factor"),
    Market = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = "Total", class = "factor"),
    Country = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = "ALL", class = "factor"),
    ISO = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = "ALL", class = "factor"),
    Sector = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = "Insurance", class = "factor"),
    Division = c(NA, NA, NA, NA, NA, NA), Furtherdetails1 = c(NA,
    NA, NA, NA, NA, NA), Furtherdetails2 = c(NA, NA, NA, NA,
    NA, NA), Indicator = structure(c(1L, 1L, 1L, 2L, 2L, 2L), .Label = c("Tax Avoidance",
    "Turnover"), class = "factor"), IndicatorID = c(20L, 20L,
    20L, 26L, 26L, 26L), Value_InputA = c(2129000000L, 2003000000L,
    1193000000L, NA, NA, NA), InputName_InputA = structure(c(2L,
    2L, 2L, 1L, 1L, 1L), .Label = c("", "Profit before tax (Attributable to shareholder profit)"
    ), class = "factor"), UnitRequired_InputA = structure(c(2L,
    2L, 2L, 1L, 1L, 1L), .Label = c("", "GBP"), class = "factor"),
    Value_InputB = c(4.47e+08, 6.2e+08, 6.47e+08, 37628, 42431,
    39833.44), InputName_InputB = structure(c(2L, 2L, 2L, 1L,
    1L, 1L), .Label = c("Number of employees", "Tax Paid"), class = "factor"),
    UnitRequired_InputB = structure(c(2L, 2L, 2L, 1L, 1L, 1L), .Label = c("#",
    "GBP"), class = "factor")), class = "data.frame", row.names = c(NA,
-6L))

Any help would be greatly appreciated!

Thanks

Body:
Using @Ronak Shah's suggestion in his comment to create a row column, the following seems to do it. I have added a second grouping column, Indicator.

library(tidyverse)

LongTest %>%
  group_by(InputCode, Indicator) %>%
  mutate(row = row_number()) %>%
  pivot_wider(id_cols = c(row, Indicator),
              names_from = InputCode,
              values_from = c(Value, UnitRequired, InputName)) %>%
  select(-row)


问:
How to set itemWidth in Buefy carousel component?
I am using Buefy Carousel List from https://buefy.org/documentation/carousel#carousel-list in a Gridsome single file component. I need to change the width of the slides from the default (476.25) to the width of my own images (176).

In Vue dev tools, I can manually override the data prop itmeWidth. This displays correctly and Vue dev tools shows that the computed prop has been changed to itemStyle: "width: 176px;"

How do I code the new width into the component? I have tried via styling (.carousel-slide width: 176px), data props (itemWidth: 176) and computed props (itemStyle: "width: 176px;"). All are ignored and the default width is applied.

答:
No API option/support for custom width slide set by CSS (Example: On swiper slidesPerView: auto is API option for this idea - see swiper demos).

https://buefy.org/documentation/carousel/#api-view

For carousel list the width added by Javascript (Inline CSS) - Example:

Anyway, !important; will change the width (Output: broken layout).

```<code>.carousel-item{
  width: 176px!important;
}
</code>```

items-to-show

One more idea/option for custom width: Use items-to-show and decimal (3.2 for example).

Body:
No API option/support for custom width slide set by CSS (Example: On swiper slidesPerView: auto is API option for this idea - see swiper demos).

https://buefy.org/documentation/carousel/#api-view

For carousel list the width added by Javascript (Inline CSS) - Example:

Anyway, !important; will change the width (Output: broken layout).

.carousel-item{
  width: 176px!important;
}

items-to-show

One more idea/option for custom width: Use items-to-show and decimal (3.2 for example).


问:
How to specify signature expressly in Alloy?
I'm learning Alloy modeling language, and I saw this code.

```<code>sig Person {
  partner: Person
}

fact partnerProperties {
  partner = ~partner
  no p: Person | p in p.partner
}
</code>```

This code express "Person's partner relation is mutual".

I can understand above code, but I think how to express partner is relation that wrote in Person expressly.
Because of readability.

I want to write like this.

```<code>fact partnerProperties {
  Person.partner = ~Person.partner
  no p: Person | p in p.partner
}
</code>```

I'm grad to help me.

答:
You make it a bit more concise by adding it as a fact to Person

```<code>sig Person { partner : Person } {
   this not in partner
   this in partner.@partner
}
</code>```

A fact added to a sig will do an automatic quantification with this over all atoms of the sig. All fields that are part of the sig will be expanded with this. in front of them. This explains the use of the @ sign. Without the @ sign, the expansion would be:

```<code>sig Person { partner : Person } {
   this not in this.partner
   this in this.partner.this.partner
}
</code>```

The this. is ok for the first partner but for the second partner the join must be with the result of (this.partner) and not this. The @ sign before the second partner tells Alloy not to put this in front of the reference. The expansion then is:

```<code>sig Person { partner : Person } {
   this not in this.partner
   this in this.partner.partner
}
</code>```

This is a solution:

```<code>┌───────────┬───────┐
│this/Person│partner│
├───────────┼───────┤
│Person⁰    │Person³│
├───────────┼───────┤
│Person¹    │Person²│
├───────────┼───────┤
│Person²    │Person¹│
├───────────┼───────┤
│Person³    │Person⁰│
└───────────┴───────┘
</code>```

Body:
I'm learning Alloy modeling language, and I saw this code.

sig Person {
  partner: Person
}

fact partnerProperties {
  partner = ~partner
  no p: Person | p in p.partner
}

This code express "Person's partner relation is mutual".

I can understand above code, but I think how to express partner is relation that wrote in Person expressly.
Because of readability.

I want to write like this.

fact partnerProperties {
  Person.partner = ~Person.partner
  no p: Person | p in p.partner
}

I'm grad to help me.

Body:
You make it a bit more concise by adding it as a fact to Person

sig Person { partner : Person } {
   this not in partner
   this in partner.@partner
}

A fact added to a sig will do an automatic quantification with this over all atoms of the sig. All fields that are part of the sig will be expanded with this. in front of them. This explains the use of the @ sign. Without the @ sign, the expansion would be:

sig Person { partner : Person } {
   this not in this.partner
   this in this.partner.this.partner
}

The this. is ok for the first partner but for the second partner the join must be with the result of (this.partner) and not this. The @ sign before the second partner tells Alloy not to put this in front of the reference. The expansion then is:

sig Person { partner : Person } {
   this not in this.partner
   this in this.partner.partner
}

This is a solution:

┌───────────┬───────┐
│this/Person│partner│
├───────────┼───────┤
│Person⁰    │Person³│
├───────────┼───────┤
│Person¹    │Person²│
├───────────┼───────┤
│Person²    │Person¹│
├───────────┼───────┤
│Person³    │Person⁰│
└───────────┴───────┘


问:
Writing to socket fails after X bytes
I'm attempting to write song data to a socket however after approximately 66338 bytes the following exception is thrown:

```<code>    E/        ( 1016): Connection reset by peer
    E/        ( 1016): java.net.SocketException: Connection reset by peer
    E/        ( 1016):  at org.apache.harmony.luni.platform.OSNetworkSystem.writeSocketImpl(Native Method)
    E/        ( 1016):  at org.apache.harmony.luni.platform.OSNetworkSystem.write(OSNetworkSystem.java:723)
    E/        ( 1016):  at org.apache.harmony.luni.net.PlainSocketImpl.write(PlainSocketImpl.java:578)
    E/        ( 1016):  at org.apache.harmony.luni.net.SocketOutputStream.write(SocketOutputStream.java:59)
    E/        ( 1016):  at com.myprogram.StreamProxy.processRequest(StreamProxy.java:307)
    E/        ( 1016):  at com.myprogram.StreamProxy.run(StreamProxy.java:145)
    E/        ( 1016):  at java.lang.Thread.run(Thread.java:1096)
</code>```

This only happens with certain songs and if one song does it all of the songs in the entire album do the same thing.  I'm wondering if it has something to do with the header information for the song?

Any suggestions on how to debug or fix this would be greatly appreciated.  Thanks.

EDIT:  Here's the code that is reading from an InputStream and writing back out to a socket.  The code is pretty straight forward so I'm not really sure why it would be crashing unless the connection is being closed on the receiving end.  (Note: this is only psuedocode, but gives the general idea)

```<code>    InputStream data = realResponse.getEntity().getContent();
    Socket socket = new ServerSocket(port, 0, InetAddress.getByAddress(new byte[] {127,0,0,1}));
    socket.setSoTimeout(5000);
    port = socket.getLocalPort();
    Socket client = socket.accept();

    ...some code...

    byte[] buff = new byte[1024 * 50];
    while (isRunning && (readBytes = data.read(buff, 0, buff.length)) != -1) {
      client.getOutputStream().write(buff, 0, readBytes);
    }
</code>```

Also, could this have anything to do with the socket buffer filling up? Especially since it seems to crash at 64k every time.

答: The server process on the other side likely had an abnormal termination (ex. SIGKILL).  That would cause a connection rest.</p>

Title: Writing to socket fails after X bytes

Body:
I'm attempting to write song data to a socket however after approximately 66338 bytes the following exception is thrown:

    E/        ( 1016): Connection reset by peer
    E/        ( 1016): java.net.SocketException: Connection reset by peer
    E/        ( 1016):  at org.apache.harmony.luni.platform.OSNetworkSystem.writeSocketImpl(Native Method)
    E/        ( 1016):  at org.apache.harmony.luni.platform.OSNetworkSystem.write(OSNetworkSystem.java:723)
    E/        ( 1016):  at org.apache.harmony.luni.net.PlainSocketImpl.write(PlainSocketImpl.java:578)
    E/        ( 1016):  at org.apache.harmony.luni.net.SocketOutputStream.write(SocketOutputStream.java:59)
    E/        ( 1016):  at com.myprogram.StreamProxy.processRequest(StreamProxy.java:307)
    E/        ( 1016):  at com.myprogram.StreamProxy.run(StreamProxy.java:145)
    E/        ( 1016):  at java.lang.Thread.run(Thread.java:1096)

This only happens with certain songs and if one song does it all of the songs in the entire album do the same thing.  I'm wondering if it has something to do with the header information for the song?

Any suggestions on how to debug or fix this would be greatly appreciated.  Thanks.

EDIT:  Here's the code that is reading from an InputStream and writing back out to a socket.  The code is pretty straight forward so I'm not really sure why it would be crashing unless the connection is being closed on the receiving end.  (Note: this is only psuedocode, but gives the general idea)

    InputStream data = realResponse.getEntity().getContent();
    Socket socket = new ServerSocket(port, 0, InetAddress.getByAddress(new byte[] {127,0,0,1}));
    socket.setSoTimeout(5000);
    port = socket.getLocalPort();
    Socket client = socket.accept();

    ...some code...

    byte[] buff = new byte[1024 * 50];
    while (isRunning && (readBytes = data.read(buff, 0, buff.length)) != -1) {
      client.getOutputStream().write(buff, 0, readBytes);
    }

Also, could this have anything to do with the socket buffer filling up? Especially since it seems to crash at 64k every time.


问:
how to loop an array and get only the value of a particular index
I am building a dynamic table where i want only 3 values from my json to display and make one a link which when clicked on, the rest displays. Below is my code kindly assist please.

```<code>var myInvestment =[
    {
      "investmentNo":"00032",
      "amount":"70000",
      "status": "Expired",
      "repayAmt":"70500",
      "description": "Official",
      "maturityDate":"2020-10-31"
  },

{
     "investmentNo":"00034",
     "amount":"5000",
     "status": "Current",
     "repayAmt":"6000",
     "description": "School fees",
     "maturityDate":"2022-03-31"
 }
]

var investmentTable = document.querySelector("#investmentTable");
        if(myInvestment.length>0){
var col = []; // define an empty array
            for (var i = 0; i < myInvestment.length; i++) {
                for (var key in myInvestment[i]) {
                    if (col.indexOf(key) === -1) {
                        col.push(key);
                    }
                }
            }

            // CREATE TABLE HEAD .
            var tHead = document.createElement("tHead");
            // CREATE ROW FOR TABLE HEAD .
            var hRow = document.createElement("tr");
            // ADD COLUMN HEADER TO ROW OF TABLE HEAD.
            tHead.appendChild(hRow);
            investmentTable.appendChild(tHead);
            // CREATE TABLE BODY .
            var tBody = document.createElement("tbody");
            // ADD COLUMN HEADER TO ROW OF TABLE HEAD.
            for (var i = 0; i < myInvestment.length; i++) {
                    var bRow = document.createElement("tr");
                    // CREATE ROW FOR EACH RECORD .
                        var td = document.createElement("td");
                        td.innerHTML = i+1;
                        bRow.appendChild(td);

                    for (var j = 0; j < 3; j++) {
                        var td = document.createElement("td");
                        if (j==0) {
                            td.innerHTML = '<a href="#" onclick = "return invModalView('+i+')">'+myInvestment[i][col[j]]+ '</a>';
                          bRow.appendChild(td);
                        }else{
                        td.innerHTML = myInvestment[i][col[j]];
                        bRow.appendChild(td);
                         }if (j==2) {
                        td.innerHTML = '<div class="badge">'+myInvestment[i][col[j]]+ '</div>';
                        if (td.textContent=="Current") {
                            td.innerHTML = '<div class="badge badge-success">'+myInvestment[i][col[j]]+ '</div>';
                        } else {
                                  td.innerHTML = '<div class="badge badge-danger">'+myInvestment[i][col[j]]+ '</div>';
                            }

                        }
                    tBody.appendChild(bRow)
                    }
            investmentTable.appendChild(tBody);
            }
}
</code>```

This is my modal function that will display the second table

```<code>function invModalView(k,myInvestment){
        var modal = document.getElementById("modal-block-normal");
        modal.style.display = "block";
        var investNo = document.getElementById("investNo");
        var investmentTableModal = document.querySelector("#investmentTableModal");

        myInvestment
  .forEach((item, i) => {

    var row = investmentTable.insertRow();

    row.insertCell(0).innerHTML = item.repayAmt;
    row.insertCell(1).innerHTML = item.description;
    row.insertCell(2).innerHTML = item.maturityDate;
  });
}
}

HTML
<table class="table table-bordered table-striped table-vcenter  table-responsive" id="investmentTableModal">

                                <thead id="invtableHead">
                                    <tr >

                                        <th class="d-sm-table-cell" style="width: 30%;">Repayment Amount</th>
                                        <td id="repayAmt"></td>
                                    </tr>
                                    <tr>
                                        <th class="d-sm-table-cell" style="width: 30%;">Description</th>
                                        <td id="description"></td>
                                    </tr>
                                    <tr>
                                        <th class="d-sm-table-cell" style="width: 30%;">Maturity Date</th>
<td id = "matureDate"></td>
                                    </tr>
</table>
</code>```

i want when a user clicks on myInvestment.investmentNo[0], only the repaymentamt, description and maturityDate of myInvestment[0] will show

答:
That's a lot of spaghetti code to go through, so I'm not even going to try.

In jQuery, what people normally do is they iterate over the array and construct each button, and then place each button on the dom. Then, they apply a $.click() on that button, and inside the .click callback they can create a clojure over the original item they created a button for.

like this: https://jsfiddle.net/0d8aL9xr/

```<code>var items = [{title: 'a bouncing ball', id: 1}, {title: 'a rubber duck', id: 2}];

items.forEach(item => {
  const $newButton = $(`<button>${item.title}</button>`);
  $('.buttons').append($newButton);
  $newButton.click(function() {
    $('#item-id').val(item.id);
    $('#item-name').val(item.title);
  })
})
</code>```

Body:
I am building a dynamic table where i want only 3 values from my json to display and make one a link which when clicked on, the rest displays. Below is my code kindly assist please.

var myInvestment =[
    {
      "investmentNo":"00032",
      "amount":"70000",
      "status": "Expired",
      "repayAmt":"70500",
      "description": "Official",
      "maturityDate":"2020-10-31"
  },

{
     "investmentNo":"00034",
     "amount":"5000",
     "status": "Current",
     "repayAmt":"6000",
     "description": "School fees",
     "maturityDate":"2022-03-31"
 }
]

var investmentTable = document.querySelector("#investmentTable");
        if(myInvestment.length>0){
var col = []; // define an empty array
            for (var i = 0; i < myInvestment.length; i++) {
                for (var key in myInvestment[i]) {
                    if (col.indexOf(key) === -1) {
                        col.push(key);
                    }
                }
            }

            // CREATE TABLE HEAD .
            var tHead = document.createElement("tHead");
            // CREATE ROW FOR TABLE HEAD .
            var hRow = document.createElement("tr");
            // ADD COLUMN HEADER TO ROW OF TABLE HEAD.
            tHead.appendChild(hRow);
            investmentTable.appendChild(tHead);
            // CREATE TABLE BODY .
            var tBody = document.createElement("tbody");
            // ADD COLUMN HEADER TO ROW OF TABLE HEAD.
            for (var i = 0; i < myInvestment.length; i++) {
                    var bRow = document.createElement("tr");
                    // CREATE ROW FOR EACH RECORD .
                        var td = document.createElement("td");
                        td.innerHTML = i+1;
                        bRow.appendChild(td);

                    for (var j = 0; j < 3; j++) {
                        var td = document.createElement("td");
                        if (j==0) {
                            td.innerHTML = ''+myInvestment[i][col[j]]+ '';
                          bRow.appendChild(td);
                        }else{
                        td.innerHTML = myInvestment[i][col[j]];
                        bRow.appendChild(td);
                         }if (j==2) {
                        td.innerHTML = '
'+myInvestment[i][col[j]]+ '
';
                        if (td.textContent=="Current") {
                            td.innerHTML = '
'+myInvestment[i][col[j]]+ '
';
                        } else {
                                  td.innerHTML = '
'+myInvestment[i][col[j]]+ '
';
                            }

                        }
                    tBody.appendChild(bRow)
                    }
            investmentTable.appendChild(tBody);
            }
}

This is my modal function that will display the second table

function invModalView(k,myInvestment){
        var modal = document.getElementById("modal-block-normal");
        modal.style.display = "block";
        var investNo = document.getElementById("investNo");
        var investmentTableModal = document.querySelector("#investmentTableModal");

        myInvestment
  .forEach((item, i) => {

    var row = investmentTable.insertRow();

    row.insertCell(0).innerHTML = item.repayAmt;
    row.insertCell(1).innerHTML = item.description;
    row.insertCell(2).innerHTML = item.maturityDate;
  });
}
}

HTML

                                        Repayment Amount

                                        Description

                                        Maturity Date

i want when a user clicks on myInvestment.investmentNo[0], only the repaymentamt, description and maturityDate of myInvestment[0] will show

Body:
That's a lot of spaghetti code to go through, so I'm not even going to try.

In jQuery, what people normally do is they iterate over the array and construct each button, and then place each button on the dom. Then, they apply a $.click() on that button, and inside the .click callback they can create a clojure over the original item they created a button for.

like this: https://jsfiddle.net/0d8aL9xr/

var items = [{title: 'a bouncing ball', id: 1}, {title: 'a rubber duck', id: 2}];

items.forEach(item => {
  const $newButton = $(`<button>${item.title}</button>`);
  $('.buttons').append($newButton);
  $newButton.click(function() {
    $('#item-id').val(item.id);
    $('#item-name').val(item.title);
  })
})


问:
How to resolve lists of IAsyncEnumerables as soon as a item is ready
```<code>public async IAsyncEnumerable<Entity> FindByIds(List<string> ids)
    {
        List<List<string>> splitIdsList = ids.Split(5);

        var entityList = splitIdsList.Select(x => FindByIdsQuery(x)).ToList();

        foreach (var entities in entityList)
        {
            await foreach (var entity in entities)
            {
                yield return entity;
            }
        }
    }

private async IAsyncEnumerable<Entity> FindByIdsQuery(List<string> ids)
    {
        var result = await Connection.QueryAsync(query, new {ids})

        foreach (var entity in result)
        {
            yield return entity;
        }
    }
</code>```

If I send 25 ids to this function. The first FindByIdsQuery takes 5000ms. The other 4 FindByIdsQuery takes 100ms. Then this solution wont output any Entities, until after 5000ms. Is there any solution that will start outputting entities as soon as there exist anyone to output. Or, if you could do something like in Task, with Task.WhenAny.

To be clear: Any of the 5 Queries can take 5000ms.

答:
From your comments, I understood your problem. What you are basically looking for is some kind of "SelectMany" operator. This operator would start awaiting all of the IAsyncEnumerables and return items in order in which they come, irrespective in what order the source async enumerables are.

I was hoping, that default AsyncEnumerable.SelectMany does this, but I found that not to be true. It goes through the source enumerables and then goes through whole inner enumerable before continuing onto next. So I hacked together SelectMany variant that properly awaits for all inner async enumerables at the same time. Be warned, I do not guarantee correctness, nor safety. There is zero error handling.

```<code>/// <summary>
/// Starts all inner IAsyncEnumerable and returns items from all of them in order in which they come.
/// </summary>
public static async IAsyncEnumerable<TItem> SelectManyAsync<TItem>(IEnumerable<IAsyncEnumerable<TItem>> source)
{
    // get enumerators from all inner IAsyncEnumerable
    var enumerators = source.Select(x => x.GetAsyncEnumerator()).ToList();

    List<Task<(IAsyncEnumerator<TItem>, bool)>> runningTasks = new List<Task<(IAsyncEnumerator<TItem>, bool)>>();

    // start all inner IAsyncEnumerable
    foreach (var asyncEnumerator in enumerators)
    {
        runningTasks.Add(MoveNextWrapped(asyncEnumerator));
    }

    // while there are any running tasks
    while (runningTasks.Any())
    {
        // get next finished task and remove it from list
        var finishedTask = await Task.WhenAny(runningTasks);
        runningTasks.Remove(finishedTask);

        // get result from finished IAsyncEnumerable
        var result = await finishedTask;
        var asyncEnumerator = result.Item1;
        var hasItem = result.Item2;

        // if IAsyncEnumerable has item, return it and put it back as running for next item
        if (hasItem)
        {
            yield return asyncEnumerator.Current;

            runningTasks.Add(MoveNextWrapped(asyncEnumerator));
        }
    }

    // don't forget to dispose, should be in finally
    foreach (var asyncEnumerator in enumerators)
    {
        await asyncEnumerator.DisposeAsync();
    }
}

/// <summary>
/// Helper method that returns Task with tuple of IAsyncEnumerable and it's result of MoveNextAsync.
/// </summary>
private static async Task<(IAsyncEnumerator<TItem>, bool)> MoveNextWrapped<TItem>(IAsyncEnumerator<TItem> asyncEnumerator)
{
    var res = await asyncEnumerator.MoveNextAsync();
    return (asyncEnumerator, res);
}
</code>```

You can then use it to merge all the enumerables instead of the first foreach:

```<code>    var entities = SelectManyAsync(splitIdsList.Select(x => FindByIdsQuery(x)));

    return entities;
</code>```

Body:
public async IAsyncEnumerable<Entity> FindByIds(List<string> ids)
    {
        List<List<string>> splitIdsList = ids.Split(5);

        var entityList = splitIdsList.Select(x => FindByIdsQuery(x)).ToList();

        foreach (var entities in entityList)
        {
            await foreach (var entity in entities)
            {
                yield return entity;
            }
        }
    }

private async IAsyncEnumerable<Entity> FindByIdsQuery(List<string> ids)
    {
        var result = await Connection.QueryAsync(query, new {ids})

        foreach (var entity in result)
        {
            yield return entity;
        }
    }

If I send 25 ids to this function. The first FindByIdsQuery takes 5000ms. The other 4 FindByIdsQuery takes 100ms. Then this solution wont output any Entities, until after 5000ms. Is there any solution that will start outputting entities as soon as there exist anyone to output. Or, if you could do something like in Task, with Task.WhenAny.

To be clear: Any of the 5 Queries can take 5000ms.

Body:
From your comments, I understood your problem. What you are basically looking for is some kind of "SelectMany" operator. This operator would start awaiting all of the IAsyncEnumerables and return items in order in which they come, irrespective in what order the source async enumerables are.

I was hoping, that default AsyncEnumerable.SelectMany does this, but I found that not to be true. It goes through the source enumerables and then goes through whole inner enumerable before continuing onto next. So I hacked together SelectMany variant that properly awaits for all inner async enumerables at the same time. Be warned, I do not guarantee correctness, nor safety. There is zero error handling.

/// <summary>
/// Starts all inner IAsyncEnumerable and returns items from all of them in order in which they come.
/// </summary>
public static async IAsyncEnumerable<TItem> SelectManyAsync<TItem>(IEnumerable<IAsyncEnumerable<TItem>> source)
{
    // get enumerators from all inner IAsyncEnumerable
    var enumerators = source.Select(x => x.GetAsyncEnumerator()).ToList();

    List<Task<(IAsyncEnumerator<TItem>, bool)>> runningTasks = new List<Task<(IAsyncEnumerator<TItem>, bool)>>();

    // start all inner IAsyncEnumerable
    foreach (var asyncEnumerator in enumerators)
    {
        runningTasks.Add(MoveNextWrapped(asyncEnumerator));
    }

    // while there are any running tasks
    while (runningTasks.Any())
    {
        // get next finished task and remove it from list
        var finishedTask = await Task.WhenAny(runningTasks);
        runningTasks.Remove(finishedTask);

        // get result from finished IAsyncEnumerable
        var result = await finishedTask;
        var asyncEnumerator = result.Item1;
        var hasItem = result.Item2;

        // if IAsyncEnumerable has item, return it and put it back as running for next item
        if (hasItem)
        {
            yield return asyncEnumerator.Current;

            runningTasks.Add(MoveNextWrapped(asyncEnumerator));
        }
    }

    // don't forget to dispose, should be in finally
    foreach (var asyncEnumerator in enumerators)
    {
        await asyncEnumerator.DisposeAsync();
    }
}

/// <summary>
/// Helper method that returns Task with tuple of IAsyncEnumerable and it's result of MoveNextAsync.
/// </summary>
private static async Task<(IAsyncEnumerator<TItem>, bool)> MoveNextWrapped<TItem>(IAsyncEnumerator<TItem> asyncEnumerator)
{
    var res = await asyncEnumerator.MoveNextAsync();
    return (asyncEnumerator, res);
}

You can then use it to merge all the enumerables instead of the first foreach:

    var entities = SelectManyAsync(splitIdsList.Select(x => FindByIdsQuery(x)));

    return entities;