# Error when close REST response

**URL:** https://discuss.elastic.co/t/error-when-close-rest-response/221577
**Category:** Elasticsearch
**Created:** [March 1, 2020, 3:02pm UTC](https://discuss.elastic.co/t/error-when-close-rest-response/221577 "2020-03-01T15:02:24Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![aiden\_elastic](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@aiden\_elastic](https://discuss.elastic.co/u/aiden_elastic)
#### Post date: [March 1, 2020, 3:02pm UTC](https://discuss.elastic.co/t/error-when-close-rest-response/221577/1 "2020-03-01T15:02:24Z")

</div>

Hi, I am using Elastic sesarch 7.6.0 with REST Client API in spring-boot.

This is problem code.

```
CloseIndexResponse closeIndexResponse = 
                    client.indices().close(requestClose, RequestOptions.DEFAULT);

```

In this part, `.close()` occurs error.

Error message :

```
The method close(org.elasticsearch.client.indices.CloseIndexRequest, 
org.elasticsearch.client.RequestOptions) in the type IndicesClient is not applicable for the 
arguments (org.elasticsearch.action.admin.indices.close.CloseIndexRequest, 
org.elasticsearch.client.RequestOptions)

```

I referenced this.

```
AcknowledgedResponse closeIndexResponse = client.indices().close(request, 
RequestOptions.DEFAULT);

```

from [https://www.elastic.co/guide/en/elasticsearch/client/java-rest/master/java-rest-high-close-index.html](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/master/java-rest-high-close-index.html)

Is there any problem?

---

<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: [March 1, 2020, 3:17pm UTC](https://discuss.elastic.co/t/error-when-close-rest-response/221577/2 "2020-03-01T15:17:50Z")

</div>

Welcome!

I think you might have different versions on the classpath.

When using springboot with  
elasticsearch, you need to be explicit with some transitive dependencies as SpringBoot declares a version 6.4...

Basically you can put this in your `pom.xml`:

```auto
<properties>
  <elasticsearch.version>7.6.0<elasticsearch.version>
</properties>

```

See documentation here: [https://docs.spring.io/spring-boot/docs/current/reference/html/howto-build.html#howto-customize-dependency-versions](https://docs.spring.io/spring-boot/docs/current/reference/html/howto-build.html#howto-customize-dependency-versions)

---

<div class="post-metadata">

### Author: ![aiden\_elastic](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@aiden\_elastic](https://discuss.elastic.co/u/aiden_elastic)
#### Post date: [March 1, 2020, 4:02pm UTC](https://discuss.elastic.co/t/error-when-close-rest-response/221577/3 "2020-03-01T16:02:02Z")

</div>

Thank you for answer.

I stated elasticsearch version in `pom.xml` like this :

```
<dependencies>
    <dependency>
    	    <groupId>org.elasticsearch</groupId>
    	    <artifactId>elasticsearch</artifactId>
    	    <version>7.6.0</version>
    </dependency>

    <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <!-- <version>6.4.3</version> --> => Leave it on during version change
            <version>7.6.0</version>
    </dependency>
</dependencies>

```

Do I have to use `<property>` tag instead of `<version>` tag?

---

<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: [March 1, 2020, 6:52pm UTC](https://discuss.elastic.co/t/error-when-close-rest-response/221577/4 "2020-03-01T18:52:53Z")

</div>

I believe so.

---

<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: [March 29, 2020, 7:08pm UTC](https://discuss.elastic.co/t/error-when-close-rest-response/221577/5 "2020-03-29T19:08:12Z")

</div>

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