How to achieve Query Performance

It's important to note that no matter what you are not going to get the
same performance if your test is 100% the same. The sacrifice of
scalability is always speed. You choose elasticsearch for it's scalability
(if you didn't then you should stick to solr) and the cost of that
scalability in a distributed system is speed.

On Friday, October 4, 2013 5:17:59 AM UTC-4, Giri M wrote:

Hi All

@David I tried the following is code snippet for term query

SearchRequestBuilder searchBuilder = newSearchRequestBuilder(client);//Node Client

searchBuilder.setIndices(new String{indexName});

searchBuilder.setTypes(new String{String.valueOf(type)});

if (sortneeded) {

searchBuilder.addSort("time_stamp", SortOrder.DESC);

}

searchBuilder.addFields(new String{"doc_no", "filename"});

searchBuilder.setFrom(from);//1

searchBuilder.setSize(size);//100

searchBuilder.setExplain(false);

searchBuilder.setSearchType(SearchType.QUERY_AND_FETCH);

searchBuilder.setPreference("_primary");

BoolFilterBuilder bf = FilterBuilders.boolFilter();

FilterBuilder tfb = bf.should(FilterBuilders.termFilter(fieldname,
value));

searchBuilder.setFilter(fb);

long startMillis = System.currentTimeMillis();

SearchResponse response = (SearchResponse)
searchBuilder.execute().actionGet();

long endMillis = System.currentTimeMillis();

term query (status:200) executed continously in ES 4 times and below are
the responses

1.ES Response : IndexName=xx_1_2013_10_01 && NumFound=1,238,306 &&
TimeTaken=2,588 ms

2.ES Response : IndexName=xx_1_2013_10_01 && NumFound=1,238,306 &&
TimeTaken=128ms

3.ES Response : IndexName=xx_1_2013_10_01 && NumFound=1,238,306 &&
TimeTaken=98ms

4.ES Response : IndexName=xx_1_2013_10_01 && NumFound=1,238,306 &&
TimeTaken=144ms

In Solr we issued same query on same index ,

1.Solr Response : IndexName=xx_1_2013_10_01 && NumFound=1,238,306 &&
TimeTaken=588 ms

2.Solr Response : IndexName=xx_1_2013_10_01 && NumFound=1,238,306 &&
TimeTaken=44 ms

3.Solr Response : IndexName=xx_1_2013_10_01 && NumFound=1,238,306 &&
TimeTaken=41 ms

4.Solr Response : IndexName=xx_1_2013_10_01 && NumFound=1,238,306 &&
TimeTaken=46 ms

@Matt

We are using classic solr 3.6.2 with no replication, We backup our indices
in DFS. To avoid this we migrating to ES.

In es , the one big index has 5 shards with 1 replica and other indices
will have 1 shard with 1 replica.

Please any one help me to resolve the problem .

On Thursday, October 3, 2013 10:05:41 PM UTC+5:30, Matt Weber wrote:

Are you using a single index with a single shard and no replicas? With
Solr, unless you have explicitly setup SolrCloud to use multiple
shards/replicas, you will be using a single index with a single shard and
no replicas. Elasticsearch on the other hand defaults to 5 shards and 1
replica. This makes a difference, so make sure you are testing identical
setups.

Also, what Joerg said, remove the outer boolean query, its not needed
unless you are going to combine multiple queries together (you are not in
your example). If sorting by the timestamp, there is no need for scoring
so the query so wrap everything in a constant score query as well. When
sorting, you also should wait until cache's are "warmed" before performing
your tests. Do this with index warmers or execute a few test queries
before you start benchmarks.

Thanks,
Matt Weber

On Thu, Oct 3, 2013 at 9:15 AM, Christian Th. chth.e...@gmail.comwrote:

Are you using an "AND" Operator in Solr and a "should" in Elasticsearch
for the "_all" query? This could make an impact.

--
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 elasticsearc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.