The ip corresponds to myvm in case you're wondering if that's the cause of
the discrepancy. ;)
On Wednesday, January 22, 2014 3:41:10 PM UTC-5, Emilie Lavigne wrote:
>
> Logically, I understand that the curl statement cannot be faster. Which
> is how I reckon that I'm doing something wrong. This is how I am timing my
> methods (from my own dev machine pointing to a vm) using the Google
> stopwatch and ticker.
>
> *Client connection to myvm:9300 using java:*
>
> ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest()
>
> .filterRoutingTable(true)
> .filterNodes(true)
> .filteredIndices(new String[]{});
>
> clusterStateRequest.listenerThreaded(false);
>
> Stopwatch timer1 = new Stopwatch(Ticker.systemTicker()).start();
>
> searcher.getClient().admin().cluster().state(clusterStateRequest).actionGet().getState().metaData();
> System.out.println("myvm:9200/_aliases " +
> timer1.stop().elapsedMillis());
>
>
> => Gets timed at 60-70ms, while curl -o /dev/null -s -w %{time_total}\\n
> myvm:9200/_aliases gets timed at 7ms
>
>
> *Client connection to myvm:9300 using java:*
>
> Stopwatch timer = new Stopwatch(Ticker.systemTicker()).start();
>
> Map<String, IndexStats> indices =
> searcher.getClient().admin().indices().prepareStats().clear().get().getIndices();
> System.out.println("myvm:9200/_stats : " + timer.stop().elapsedMillis());
>
>
> => gets timed to 25-35ms, while curl -o /dev/null -s -w %{time_total}\\n
> 10.40.1.218:9200/_stats gets timed to 20-30ms
>
> As you can see, the latter gets similar timings in both java and curl,
> while the former gets very different timings for what the code inspired by
> the class RestGetIndicesAliasesAction.
>
> The other example, I cannot use. I consistently get an empty map back
> even if I replace the null with a string.
>
> Emilie
>
> On Tuesday, January 21, 2014 5:24:26 PM UTC-5, Jörg Prante wrote:
>>
>> Yes, asking the cluster state is possible to filter out for aliases (that
>> is what the TransportGetAliasesAction is doing, too)
>>
>> I was using 1.0.0.RC1, RestGetIndicesAliasAction is deprecated in
>> 1.0.0.RC1
>>
>> A null argument to GetAliasesRequest gives an NPE, but an empty string
>> works:
>>
>> GetAliasesRequest getAliasesRequest = new GetAliasesRequest("");
>> GetAliasesResponse response =
>> client.admin().indices().getAliases(getAliasesRequest).actionGet();
>> logger.info("{}", response.getAliases());
>>
>> The curl command can not be faster simply because it calls the Java
>> action in the background, o I'm wondering what timestamps you are measuring.
>>
>> Jörg
>>
>>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/566943fa-0356-4d8b-baf3-e5caa47a2be2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.