# Isue error by elasticsearch-rest-high-level-client to create Index

**URL:** https://discuss.elastic.co/t/isue-error-by-elasticsearch-rest-high-level-client-to-create-index/269281
**Category:** Elasticsearch
**Tags:** docker, language-clients
**Created:** [April 6, 2021, 4:06am UTC](https://discuss.elastic.co/t/isue-error-by-elasticsearch-rest-high-level-client-to-create-index/269281 "2021-04-06T04:06:29Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![votouch904931293](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@votouch904931293](https://discuss.elastic.co/u/votouch904931293)
#### Post date: [April 6, 2021, 4:06am UTC](https://discuss.elastic.co/t/isue-error-by-elasticsearch-rest-high-level-client-to-create-index/269281/1 "2021-04-06T04:06:29Z")

</div>

i use doc url:[Maven Repository | Java REST Client [6.8] | Elastic](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.8/java-rest-high-getting-started-maven.html)  
i has get init and try to cread indexrequest , the system exception error,for this  
Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: org.elasticsearch.action.index.IndexRequest.parent()Ljava/lang/String;  
demo:  
**my init code :**

```auto
 public RestHighLevelClient getClient(){

                RestClientBuilder builder = RestClient.builder(
                new HttpHost("192.168.8.22", 9200, "http"));
        this.client = new RestHighLevelClient(builder);
        return this.client;
    }

```

**try to create index code:**

```auto
public boolean indexRequest(String indexName, String type, Map<String, Object> docContent) {
        IndexRequest request = new IndexRequest(
                indexName,
                type);

        //time oue
        request.opType(DocWriteRequest.OpType.CREATE);
        request.opType("create");
        request.timeout(TimeValue.timeValueSeconds(1));

        try {
            request.source(docContent);
            IndexResponse response = this.esClient.getClient().index(request, RequestOptions.DEFAULT);
            if(!(response.status().getStatus()==200)){
                return false;
            }
        } catch (IOException e) {
            //fail
            return false;
        }
        return false;
    }

```

**my pom code es version** :

```auto
<dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>6.8.15</version>
 </dependency>

```

this pom ,i use for es doc example doc  
url :[Maven Repository | Java REST Client [6.8] | Elastic](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.8/java-rest-high-getting-started-maven.html)

**monitor print show error code** :

```auto
2021-04-06 14:10:55.566 ERROR 10180 --- [nio-8081-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: org.elasticsearch.action.index.IndexRequest.parent()Ljava/lang/String;] with root cause

java.lang.NoSuchMethodError: org.elasticsearch.action.index.IndexRequest.parent()Ljava/lang/String;
	at org.elasticsearch.client.RequestConverters.index(RequestConverters.java:314) ~[elasticsearch-rest-high-level-client-6.8.15.jar:7.6.2]
	at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1761) ~[elasticsearch-rest-high-level-client-6.8.15.jar:7.6.2]
	at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1735) ~[elasticsearch-rest-high-level-client-6.8.15.jar:7.6.2]
	at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1697) ~[elasticsearch-rest-high-level-client-6.8.15.jar:7.6.2]
	at org.elasticsearch.client.RestHighLevelClient.index(RestHighLevelClient.java:929) ~[elasticsearch-rest-high-level-client-6.8.15.jar:7.6.2]
	at iot.xin.esutil.EsIndexUtils.indexRequest(EsIndexUtils.java:110) ~[classes/:na]
	at iot.xin.controller.TestController.addIndex(TestController.java:29) ~[classes/:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_162]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_162]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_162]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_162]
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.2.13.RELEASE.jar:5.2.13.RELEASE]
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.2.13.RELEASE.jar:5.2.13.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) ~[spring-webmvc-5.2.13.RELEASE.jar:5.2.13.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:878) ~[spring-webmvc-5.2.13.RELEASE.jar:5.2.13.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:792) ~[spring-webmvc-5.2.13.RELEASE.jar:5.2.13.RELEASE]
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.2.13.RELEASE.jar:5.2.13.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) ~[spring-webmvc-5.2.13.RELEASE.jar:5.2.13.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.2.13.RELEASE.jar:5.2.13.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.13.RELEASE.jar:5.2.13.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.2.13.RELEASE.jar:5.2.13.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:652) ~[tomcat-embed-core-9.0.43.jar:4.0.FR]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.2.13.RELEASE.jar:5.2.13.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar:4.0.FR]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar:9.0.43]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.2.13.RELEASE.jar:5.2.13.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.13.RELEASE.jar:5.2.13.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.2.13.RELEASE.jar:5.2.13.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.13.RELEASE.jar:5.2.13.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.2.13.RELEASE.jar:5.2.13.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.13.RELEASE.jar:5.2.13.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar:9.0.43]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar:9.0.43]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_162]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_162]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar:9.0.43]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]

```

,actually ，i no't chose hight version es , i using es version is 6.8.5 , so , my pon maven es-client version toggther with es .

so,what should i do?

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [April 6, 2021, 5:54am UTC](https://discuss.elastic.co/t/isue-error-by-elasticsearch-rest-high-level-client-to-create-index/269281/2 "2021-04-06T05:54:04Z")

</div>

Welcome!

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

This is the icon to use if you are not using markdown format:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7e6e239431ec2d71cbf1beef741f2e93e7cc762c.jpg)

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.  
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.  
Please update your post.

Also share what gives

```
mvn dependency:tree
```

---

<div class="post-metadata">

### Author: ![votouch904931293](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@votouch904931293](https://discuss.elastic.co/u/votouch904931293)
#### Post date: [April 6, 2021, 6:08am UTC](https://discuss.elastic.co/t/isue-error-by-elasticsearch-rest-high-level-client-to-create-index/269281/3 "2021-04-06T06:08:11Z")

</div>

sorry， i wan't useing \</\>util btn , but's is so terrible, the web pape show content is not for my want, so ,i choes to Img

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [April 6, 2021, 6:21am UTC](https://discuss.elastic.co/t/isue-error-by-elasticsearch-rest-high-level-client-to-create-index/269281/4 "2021-04-06T06:21:32Z")

</div>

Please don't post images of text as they are hard to read, may not display correctly for everyone, and are not searchable.

Instead, paste the text and format it with `</>` icon or pairs of triple backticks (```), and check the preview window to make sure it's properly formatted before posting it. This makes it more likely that your question will receive a useful answer.

It would be great if you could update your post to solve this.

And please answer this question:

```
mvn dependency:tree
```

---

<div class="post-metadata">

### Author: ![votouch904931293](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@votouch904931293](https://discuss.elastic.co/u/votouch904931293)
#### Post date: [April 6, 2021, 6:24am UTC](https://discuss.elastic.co/t/isue-error-by-elasticsearch-rest-high-level-client-to-create-index/269281/5 "2021-04-06T06:24:40Z")

</div>

i trying ,i trying ...... 🥶 🥶 🥶 🥶 🥶

---

<div class="post-metadata">

### Author: ![votouch904931293](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@votouch904931293](https://discuss.elastic.co/u/votouch904931293)
#### Post date: [April 6, 2021, 6:30am UTC](https://discuss.elastic.co/t/isue-error-by-elasticsearch-rest-high-level-client-to-create-index/269281/6 "2021-04-06T06:30:25Z")

</div>

sir , my problem has change , plz , renews my question

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [April 6, 2021, 9:30am UTC](https://discuss.elastic.co/t/isue-error-by-elasticsearch-rest-high-level-client-to-create-index/269281/7 "2021-04-06T09:30:01Z")

</div>

That's very good. Thank you for editing your post!

Could you now run:

```
mvn dependency:tree

```

And share here the ouput?

---

<div class="post-metadata">

### Author: ![votouch904931293](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@votouch904931293](https://discuss.elastic.co/u/votouch904931293)
#### Post date: [April 7, 2021, 12:49am UTC](https://discuss.elastic.co/t/isue-error-by-elasticsearch-rest-high-level-client-to-create-index/269281/8 "2021-04-07T00:49:14Z")

</div>

🤣 o my god , the god make joke to me , i remenber to put es pom . only pu es hitght client pom , so , i process can't never run in ayning time . but's our official doc just tell us how to quite use hight client , forget decencency basic es pom , like this

```auto
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>6.8.6</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
<!-- <version>7.0.1</version>-->
            <version>6.8.6</version>
        </dependency>

```

**official doc url**  
page do not show :[Maven Repository | Java REST Client [7.12] | Elastic](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-getting-started-maven.html)

```auto
<dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>6.8.6</version>
        </dependency>

```

so , i suggest deppend elasticsearch version in to the official doc , not olny can remove doubts people question in mind , but also can quik start how to use without anying probleam ,At least for tiro，like me . 😂

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [May 5, 2021, 12:50am UTC](https://discuss.elastic.co/t/isue-error-by-elasticsearch-rest-high-level-client-to-create-index/269281/9 "2021-05-05T00:50:08Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
