# Worried about app after moving to 6.6.1

**URL:** <https://discuss.elastic.co/t/worried-about-app-after-moving-to-6-6-1/172548>\
**Category:** Elasticsearch\
**Created:** [March 15, 2019, 2:15pm UTC](https://discuss.elastic.co/t/worried-about-app-after-moving-to-6-6-1/172548 "2019-03-15T14:15:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mc1392](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@mc1392](https://discuss.elastic.co/u/mc1392)\
**Post date:** [March 15, 2019, 2:15pm UTC](https://discuss.elastic.co/t/worried-about-app-after-moving-to-6-6-1/172548/1 "2019-03-15T14:15:18Z")

</div>

Since moving to 6.6.1 REST client, I noticed my client connection is not closing.  
So I am using a System.exit(0) at the method end.  
FYI: The document is getting stored and update din Elastic!

This is how I get my client/authenticate:

```
String CREDENTIALS_STRING = this.username+":"+this.password;
		String encodedBytes = Base64.getEncoder().encodeToString(CREDENTIALS_STRING.getBytes());
		Header[] headers = { new BasicHeader(HttpHeaders.CONTENT_TYPE, "application/json"),
				new BasicHeader("Authorization", "Basic " + encodedBytes) };
		this.client = new RestHighLevelClient(RestClient.builder(
		        new HttpHost(this.END_POINT, 9243, "https")).setDefaultHeaders(headers));
		return this.client;

```

This is how I used to do it:

```
String CREDENTIALS_STRING = this.username+":"+this.password;
		String encodedBytes = Base64.getEncoder().encodeToString(CREDENTIALS_STRING.getBytes());
		Header[] headers = { new BasicHeader(HttpHeaders.CONTENT_TYPE, "application/json"),
				new BasicHeader("Authorization", "Basic " + encodedBytes) };
		this.restLowLevelClient = RestClient.builder(
		        new HttpHost(this.END_POINT, 9243, "https")).setDefaultHeaders(headers).build();
		this.client = new RestHighLevelClient(restLowLevelClient);
		
		return this.client;

```

At the end of the request, I am attempting to evaluate the response. I am getting "NOOP" when I check the UpdateResponse, what does that mean?:

```
IndexRequest indexRequest = new IndexRequest(indexName, docType,
					String.valueOf(fieldMap.get(updateIdField))).source(fieldMap);

			UpdateRequest upR = new UpdateRequest(indexName, docType, String.valueOf(fieldMap.get(updateIdField)))
					.doc(indexRequest).upsert(indexRequest);

			UpdateResponse updateResponse = null;
			try {
				updateResponse = client.update(upR, RequestOptions.DEFAULT);
				
				System.out.println(updateResponse.getResult());
				//here it's printing "NOOP"
				
			} catch (IOException ioe) {
				ioe.printStackTrace();
			}

```

Also, when I send the request, I use RequestOptions.DEFAULT. does this interfere with my Headers that I set initially when getting the client? I feel like I may be undoing the client when I follow up using DEFAULT RequestOptions?? :

`updateResponse = client.update(upR, RequestOptions.DEFAULT);`

---

<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 16, 2019, 1:55am UTC](https://discuss.elastic.co/t/worried-about-app-after-moving-to-6-6-1/172548/2 "2019-03-16T01:55:16Z")

</div>

Not sure I understood the problem.  
Did you call `client.close();` ?

---

<div class="post-metadata">

**Author:** ![mc1392](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@mc1392](https://discuss.elastic.co/u/mc1392)\
**Post date:** [March 18, 2019, 2:03pm UTC](https://discuss.elastic.co/t/worried-about-app-after-moving-to-6-6-1/172548/3 "2019-03-18T14:03:16Z")

</div>

calling client.close() is not working.  
My eclipse is still running, unless I use `System.exit(0);`

---

<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 18, 2019, 2:16pm UTC](https://discuss.elastic.co/t/worried-about-app-after-moving-to-6-6-1/172548/4 "2019-03-18T14:16:15Z")

</div>

Could you share a full project that reproduces your problem?

It can be super simple like:

```auto
public class App {
    public static void main(String[] args) throws IOException {
        RestHighLevelClient client = new RestHighLevelClient(
            RestClient.builder(HttpHost.create("http://localhost:9200")));
        
        try {
             client.indices().delete(new DeleteIndexRequest("test"), RequestOptions.DEFAULT);
            for (int i = 0; i < 100; i++) {
                client.index(new IndexRequest("test", "_doc").source("foo", "bar"), RequestOptions.DEFAULT);
            }
            client.indices().refresh(new RefreshRequest("test"), RequestOptions.DEFAULT);

            SearchRequest searchRequest = new SearchRequest("test");
            SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT);

            System.out.println("response size = " + searchResponse.getHits().getHits().length);
        } catch (Exception e) {
            e.printStackTrace(System.err);
        } finally {
            client.close();
        }
    }
}

```

---

<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:** [April 15, 2019, 2:16pm UTC](https://discuss.elastic.co/t/worried-about-app-after-moving-to-6-6-1/172548/5 "2019-04-15T14:16:16Z")

</div>

Closed on April 15, 2019, 2:16pm UTC

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