# Elasticsearch in Local mode is slow

**URL:** <https://discuss.elastic.co/t/elasticsearch-in-local-mode-is-slow/19675>\
**Category:** Elasticsearch\
**Created:** [September 9, 2014, 6:55am UTC](https://discuss.elastic.co/t/elasticsearch-in-local-mode-is-slow/19675 "2014-09-09T06:55:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sarathrs](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@sarathrs](https://discuss.elastic.co/u/sarathrs)\
**Post date:** [September 9, 2014, 6:55am UTC](https://discuss.elastic.co/t/elasticsearch-in-local-mode-is-slow/19675/1 "2014-09-09T06:55:06Z")

</div>

Hi,

I have populated elasticsearch index in local mode using node client with  
number of shards as 1 and number of replicas as 0. When i run a boolean  
query, it is taking 200ms to execute and fetch results. Same code using  
node client in local mode pointing to the cluster running on my  
machine(which has same index data) it took 35ms to execute and fetch  
results. Why elasticsearch index in local mode is slow?. Following is the  
code

Builder builder = ImmutableSettings.settingsBuilder();  
Settings settings = builder.put("path.data", USER\_DIR+"\data")  
.put("index.number\_of\_shards", "1")  
.put("index.number\_of\_replicas", "0")  
.put("discovery.zen.ping.multicast.enabled", false)  
.put("discovery.zen.ping.unicast.hosts", "localhost")  
.put("http.enabled", false)  
.put("index.store.type", "mmapfs")  
.put("indices.memory.index\_buffer\_size", "30%")  
.put("index.translog.flush\_threshold\_ops", "50000")  
.put("refresh\_interval", "5s")  
.put("index.blocks.write", true)  
.put("index.blocks.metadata", true)  
.build();  
Node node = NodeBuilder.nodeBuilder().local(true).settings(settings  
).clusterName("sarath1").node();  
long st = System.currentTimeMillis();  
node.client().admin().cluster().prepareHealth("places").setWaitForGreenStatus().execute().actionGet();  
long et = System.currentTimeMillis();  
System.out.println("Time taken to refresh...."+(et-st));  
SearchRequestBuilder searchQuery = node.client().prepareSearch("places")  
.setFilter(FilterBuilders.termFilter("City","toronto"))  
.setTypes("location")  
.setSearchType("query\_then\_fetch")  
.setSize(10)  
.setFrom(0);  
st = System.currentTimeMillis();  
SearchHits hits = searchQuery.execute().actionGet().getHits();  
et = System.currentTimeMillis();  
System.out.println("Time taken to search "+(et-st));  
if(hits.getTotalHits() \> 0){  
SearchHit[] hitsResult = hits.getHits();  
for(SearchHit searchHit : hitsResult){  
System.out.println(searchHit.getSourceAsString());  
}  
}

Thanks,  
Sarath

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/3a34ef4a-269e-42a0-b9f8-19dc2dd217ae%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3a34ef4a-269e-42a0-b9f8-19dc2dd217ae%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:03am UTC](https://discuss.elastic.co/t/elasticsearch-in-local-mode-is-slow/19675/2 "2017-07-06T01:03:48Z")

</div>


