# Elasticsearch Transport client performance vs. Sense plugin

**URL:** <https://discuss.elastic.co/t/elasticsearch-transport-client-performance-vs-sense-plugin/52908>\
**Category:** Elasticsearch\
**Created:** [June 15, 2016, 6:26pm UTC](https://discuss.elastic.co/t/elasticsearch-transport-client-performance-vs-sense-plugin/52908 "2016-06-15T18:26:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ESDev17](https://avatars.discourse-cdn.com/v4/letter/e/439d5e/32.png) [@ESDev17](https://discuss.elastic.co/u/ESDev17)\
**Post date:** [June 15, 2016, 6:26pm UTC](https://discuss.elastic.co/t/elasticsearch-transport-client-performance-vs-sense-plugin/52908/1 "2016-06-15T18:26:37Z")

</div>

I am trying to understand why the performance of the response from my transport client execution in milliseconds is almost an entire order of magnitude slower than the response I get when executing the same query in the Sense plugin.

Lets say I run a very basic query in Sense like:

GET /my\_index/my\_type/\_search  
{  
"query": {  
"bool": {}  
}  
}

On a set of 30 million records I am getting response times like 250-500 ms.

When I run the same thing with a java block like this:

SearchResponse response = client.prepareSearch("my\_index")  
.setTypes("my\_type")  
.setSearchType(SearchType.DFS\_QUERY\_THEN\_FETCH)  
.setQuery(queryBuilder)  
.execute().actionGet();

System.out.println(response .getTookInMillis());

I get response times ranging from 2000-5000ms

Where client is a transport client with default settings and the queryBuilder is an empty BoolQueryBuilder (thus the same query as above). I have only added a timeout and custom cluster name to the client settings.

My cluster is just 2 master nodes.

Any ideas where this large performance gap could be occuring?

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [June 15, 2016, 9:33pm UTC](https://discuss.elastic.co/t/elasticsearch-transport-client-performance-vs-sense-plugin/52908/2 "2016-06-15T21:33:47Z")

</div>

Why do you use slow `DFS_QUERY_THEN_FETCH`?

---

<div class="post-metadata">

**Author:** ![ESDev17](https://avatars.discourse-cdn.com/v4/letter/e/439d5e/32.png) [@ESDev17](https://discuss.elastic.co/u/ESDev17)\
**Post date:** [June 16, 2016, 1:10pm UTC](https://discuss.elastic.co/t/elasticsearch-transport-client-performance-vs-sense-plugin/52908/3 "2016-06-16T13:10:13Z")

</div>

No reason - I had tried switching to just QUERY\_THEN\_FETCH and did not see any noticeable improvement.

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [June 17, 2016, 10:16am UTC](https://discuss.elastic.co/t/elasticsearch-transport-client-performance-vs-sense-plugin/52908/4 "2016-06-17T10:16:22Z")

</div>

Do not set the search type, it confuses your measurements.

HTTP query

```auto
POST /index/_search
{
  "query": {
    "bool": {}
  }
}

```

has exact same search 'took' time like

```auto
SearchResponse response = client.prepareSearch()
  .setIndices(index)
  .setQuery(boolQuery())
  .execute().actionGet()

```

Check your network settings (host names, DNS resolution, routing) if they produce lags in your Java client. Java is very picky about that.

---

<div class="post-metadata">

**Author:** ![ESDev17](https://avatars.discourse-cdn.com/v4/letter/e/439d5e/32.png) [@ESDev17](https://discuss.elastic.co/u/ESDev17)\
**Post date:** [June 20, 2016, 3:11pm UTC](https://discuss.elastic.co/t/elasticsearch-transport-client-performance-vs-sense-plugin/52908/5 "2016-06-20T15:11:35Z")

</div>

I will check out my network settings. I am using multiple types in my index and specifying that type in my java search - thus i wold expect my measurements to be consistent.

---

<div class="post-metadata">

**Author:** ![NRS](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@NRS](https://discuss.elastic.co/u/NRS)\
**Post date:** [October 3, 2016, 12:28pm UTC](https://discuss.elastic.co/t/elasticsearch-transport-client-performance-vs-sense-plugin/52908/6 "2016-10-03T12:28:52Z")

</div>

I am facing the same issue . When I use curl to get response , it takes around 40-50 ms . But When same query is executed using execute().actionGet() using TransportClient , it takes around 1000 ms. Trying to figure out the root cause and the solution of this problem . Could anybody pls help me out with this

---

<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:** [October 3, 2016, 1:16pm UTC](https://discuss.elastic.co/t/elasticsearch-transport-client-performance-vs-sense-plugin/52908/7 "2016-10-03T13:16:37Z")

</div>

Please don't send the same question multiple times. Does not help.

---

<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:** [July 5, 2017, 10:15pm UTC](https://discuss.elastic.co/t/elasticsearch-transport-client-performance-vs-sense-plugin/52908/8 "2017-07-05T22:15:26Z")

</div>


