Elasticsearch in Local mode is slow

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Elasticsearch in Local mode is slow

sarathrs
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/3a34ef4a-269e-42a0-b9f8-19dc2dd217ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.