Gets and searches operations using only Java client API

When I use Java client by:
Node node = nodeBuilder().node();
Client client = node.client();
and using this client to "get operation" like:
GetResponse response = client.prepareGet("twitter", "tweet", "1")
.execute()
.actionGet();
or "search operation" like:
SearchResponse response = client.prepareSearch("test")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(termQuery("multi", "test"))
.setFrom(0).setSize(60).setExplain(true)
.execute()
.actionGet();
I got those exceptions:

Exception in thread "main"
org.elasticsearch.action.NoShardAvailableActionException:
[twitter][2] No shard available for [[twitter][tweet][1]: routing [null]]

Exception in thread "main"
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to
execute phase [dfs],
total failure; shardFailures {[na][twitter][0]: No active
shards}{[na][twitter][1]: No active shards}{[na][twitter][2]:
No active shards}{[na][twitter][3]: No active shards}{[na][twitter][4]:
No active shards}

Can I do those gets ans searches by my Java client without running first ES
started in windows?

--
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.

Hey,
Look at: https://github.com/elasticsearchfr/hands-on/tree/answers

BTW, you have first to create documents before being able to search for them.

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 2 févr. 2013 à 15:54, JJack_PL jjacek.pl@gmail.com a écrit :

When I use Java client by:
Node node = nodeBuilder().node();
Client client = node.client();
and using this client to "get operation" like:
GetResponse response = client.prepareGet("twitter", "tweet", "1")
.execute()
.actionGet();
or "search operation" like:
SearchResponse response = client.prepareSearch("test")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(termQuery("multi", "test"))
.setFrom(0).setSize(60).setExplain(true)
.execute()
.actionGet();
I got those exceptions:

Exception in thread "main" org.elasticsearch.action.NoShardAvailableActionException:
[twitter][2] No shard available for [[twitter][tweet][1]: routing [null]]

Exception in thread "main" org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to execute phase [dfs],
total failure; shardFailures {[na][twitter][0]: No active shards}{[na][twitter][1]: No active shards}{[na][twitter][2]:
No active shards}{[na][twitter][3]: No active shards}{[na][twitter][4]: No active shards}

Can I do those gets ans searches by my Java client without running first ES started in windows?

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.

--
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.

I have figured out I can do this gets and searches operations using only
one node created in Java (I use default data node)
but I have to wait after gateway recovery process will end AND until
probably shards will be located in my one node.

So if I will run my Jave client like this:

Node node = nodeBuilder().node();
Client client = node.client();

    GetResponse response = client.prepareGet("twitter", "tweet", "2") 
      .execute()
      .actionGet();

I will get this exception ...

lut 03, 2013 6:33:35 PM org.elasticsearch.node
INFO: [Grog the God-Crusher] {0.20.2}[6756]: initializing ...
lut 03, 2013 6:33:35 PM org.elasticsearch.plugins
INFO: [Grog the God-Crusher] loaded [], sites []
lut 03, 2013 6:33:37 PM org.elasticsearch.node
INFO: [Grog the God-Crusher] {0.20.2}[6756]: initialized
lut 03, 2013 6:33:37 PM org.elasticsearch.node
INFO: [Grog the God-Crusher] {0.20.2}[6756]: starting ...
lut 03, 2013 6:33:37 PM org.elasticsearch.transport
INFO: [Grog the God-Crusher] bound_address {inet[/0:0:0:0:0:0:0:0:9300]},
publish_address {inet[/192.168.0.101:9300]}
lut 03, 2013 6:33:40 PM org.elasticsearch.cluster.service
INFO: [Grog the God-Crusher] new_master [Grog the
God-Crusher][kBlV01OYSBuyQvRk3my19w][inet[/192.168.0.101:9300]], reason:
zen-disco-join (elected_as_master)
lut 03, 2013 6:33:40 PM org.elasticsearch.discovery
INFO: [Grog the God-Crusher] elasticsearch/kBlV01OYSBuyQvRk3my19w
lut 03, 2013 6:33:40 PM org.elasticsearch.http
INFO: [Grog the God-Crusher] bound_address {inet[/0:0:0:0:0:0:0:0:9200]},
publish_address {inet[/192.168.0.101:9200]}
lut 03, 2013 6:33:40 PM org.elasticsearch.node
INFO: [Grog the God-Crusher] {0.20.2}[6756]: started
Exception in thread "main"
org.elasticsearch.action.NoShardAvailableActionException: [twitter][3] No
shard available for [[twitter][tweet][2]: routing [null]]

And for example if I will run Java client with more time to Gateway recover
and alocate shards like this:

Node node = nodeBuilder().node();
Client client = node.client();

    Thread.sleep(2000);
    
    GetResponse response = client.prepareGet("twitter", "tweet", "2") 
      .execute()
      .actionGet();

.
.
.
INFO: [Time Bomb] {0.20.2}[6164]: started
lut 03, 2013 6:38:41 PM org.elasticsearch.gateway
INFO: [Time Bomb] recovered [20] indices into cluster_state

I wont get any exception and all will work ok.

Can I use any API to find out when I restart cluster (Gateway recovery) to
check if all alocating shards process is done?
If so I could then execute safely operations like gets and searches without
to be worry about any shard exeption etc.

W dniu sobota, 2 lutego 2013 16:05:01 UTC+1 użytkownik David Pilato napisał:

Hey,
Look at: https://github.com/elasticsearchfr/hands-on/tree/answers

BTW, you have first to create documents before being able to search for
them.

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 2 févr. 2013 à 15:54, JJack_PL <jjac...@gmail.com <javascript:>> a
écrit :

When I use Java client by:
Node node = nodeBuilder().node();
Client client = node.client();
and using this client to "get operation" like:
GetResponse response = client.prepareGet("twitter", "tweet", "1")
.execute()
.actionGet();
or "search operation" like:
SearchResponse response = client.prepareSearch("test")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(termQuery("multi", "test"))
.setFrom(0).setSize(60).setExplain(true)
.execute()
.actionGet();
I got those exceptions:

Exception in thread "main"
org.elasticsearch.action.NoShardAvailableActionException:
[twitter][2] No shard available for [[twitter][tweet][1]: routing [null]]

Exception in thread "main"
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to
execute phase [dfs],
total failure; shardFailures {[na][twitter][0]: No active
shards}{[na][twitter][1]: No active shards}{[na][twitter][2]:
No active shards}{[na][twitter][3]: No active
shards}{[na][twitter][4]: No active shards}

Can I do those gets ans searches by my Java client without running first
ES started in windows?

--
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 <javascript:>.
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.

Hello!

Maybe you can just wait for yellow or green status ? If you can just execute a code like:

client.admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet();

--

Regards,

Rafał Kuć

Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch

I have figured out I can do this gets and searches operations using only one node created in Java (I use default data node)

but I have to wait after gateway recovery process will end AND until probably shards will be located in my one node.

So if I will run my Jave client like this:

Node node = nodeBuilder().node();

    Client client = node.client();


    


    GetResponse response = client.prepareGet("twitter", "tweet", "2") 


      .execute()


      .actionGet();

I will get this exception ...

lut 03, 2013 6:33:35 PM org.elasticsearch.node

INFO: [Grog the God-Crusher] {0.20.2}[6756]: initializing ...

lut 03, 2013 6:33:35 PM org.elasticsearch.plugins

INFO: [Grog the God-Crusher] loaded [], sites []

lut 03, 2013 6:33:37 PM org.elasticsearch.node

INFO: [Grog the God-Crusher] {0.20.2}[6756]: initialized

lut 03, 2013 6:33:37 PM org.elasticsearch.node

INFO: [Grog the God-Crusher] {0.20.2}[6756]: starting ...

lut 03, 2013 6:33:37 PM org.elasticsearch.transport

INFO: [Grog the God-Crusher] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/192.168.0.101:9300]}

lut 03, 2013 6:33:40 PM org.elasticsearch.cluster.service

INFO: [Grog the God-Crusher] new_master [Grog the God-Crusher][kBlV01OYSBuyQvRk3my19w][inet[/192.168.0.101:9300]], reason: zen-disco-join (elected_as_master)

lut 03, 2013 6:33:40 PM org.elasticsearch.discovery

INFO: [Grog the God-Crusher] elasticsearch/kBlV01OYSBuyQvRk3my19w

lut 03, 2013 6:33:40 PM org.elasticsearch.http

INFO: [Grog the God-Crusher] bound_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish_address {inet[/192.168.0.101:9200]}

lut 03, 2013 6:33:40 PM org.elasticsearch.node

INFO: [Grog the God-Crusher] {0.20.2}[6756]: started

Exception in thread "main" org.elasticsearch.action.NoShardAvailableActionException: [twitter][3] No shard available for [[twitter][tweet][2]: routing [null]]

And for example if I will run Java client with more time to Gateway recover and alocate shards like this:

Node node = nodeBuilder().node();

    Client client = node.client();


    


    Thread.sleep(2000);


    


    GetResponse response = client.prepareGet("twitter", "tweet", "2") 


      .execute()


      .actionGet();

.

.

.

INFO: [Time Bomb] {0.20.2}[6164]: started

lut 03, 2013 6:38:41 PM org.elasticsearch.gateway

INFO: [Time Bomb] recovered [20] indices into cluster_state

I wont get any exception and all will work ok.

Can I use any API to find out when I restart cluster (Gateway recovery) to check if all alocating shards process is done?

If so I could then execute safely operations like gets and searches without to be worry about any shard exeption etc.

W dniu sobota, 2 lutego 2013 16:05:01 UTC+1 użytkownik David Pilato napisał:

Hey,

Look at: https://github.com/elasticsearchfr/hands-on/tree/answers

BTW, you have first to create documents before being able to search for them.

HTH

--

David :wink:

Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 2 févr. 2013 à 15:54, JJack_PL <jjac...@gmail.com> a écrit :

When I use Java client by:

Node node = nodeBuilder().node();

Client client = node.client();

and using this client to "get operation" like:

GetResponse response = client.prepareGet("twitter", "tweet", "1")

      .execute()


      .actionGet();

or "search operation" like:

SearchResponse response = client.prepareSearch("test")

      .setSearchType(SearchType.DFS_QUERY_THEN_FETCH)


      .setQuery(termQuery("multi", "test"))


      .setFrom(0).setSize(60).setExplain(true)


      .execute()


      .actionGet();

I got those exceptions:

Exception in thread "main" org.elasticsearch.action.NoShardAvailableActionException:

[twitter][2] No shard available for [[twitter][tweet][1]: routing [null]]

Exception in thread "main" org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to execute phase [dfs],

total failure; shardFailures {[na][twitter][0]: No active shards}{[na][twitter][1]: No active shards}{[na][twitter][2]:

No active shards}{[na][twitter][3]: No active shards}{[na][twitter][4]: No active shards}

Can I do those gets ans searches by my Java client without running first ES started in windows?

--

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.

It works very well, thx!

W dniu niedziela, 3 lutego 2013 19:03:53 UTC+1 użytkownik Rafał Kuć napisał:

Hello!

Maybe you can just wait for yellow or green status ? If you can just
execute a code like:

client.admin().cluster().health(new
ClusterHealthRequest().waitForGreenStatus()).actionGet();

*--
Regards,
Rafał Kuć
Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch -
ElasticSearch

I have figured out I can do this gets and searches operations using only
one node created in Java (I use default data node)
but I have to wait after gateway recovery process will end AND until
probably shards will be located in my one node.

So if I will run my Jave client like this:

Node node = nodeBuilder().node();
Client client = node.client();

    GetResponse response = client.prepareGet("twitter", "tweet", "2") 
      .execute()
      .actionGet();

I will get this exception ...

lut 03, 2013 6:33:35 PM org.elasticsearch.node
INFO: [Grog the God-Crusher] {0.20.2}[6756]: initializing ...
lut 03, 2013 6:33:35 PM org.elasticsearch.plugins
INFO: [Grog the God-Crusher] loaded [], sites []
lut 03, 2013 6:33:37 PM org.elasticsearch.node
INFO: [Grog the God-Crusher] {0.20.2}[6756]: initialized
lut 03, 2013 6:33:37 PM org.elasticsearch.node
INFO: [Grog the God-Crusher] {0.20.2}[6756]: starting ...
lut 03, 2013 6:33:37 PM org.elasticsearch.transport
INFO: [Grog the God-Crusher] bound_address {inet[/0:0:0:0:0:0:0:0:9300]},
publish_address {inet[/192.168.0.101:9300]}
lut 03, 2013 6:33:40 PM org.elasticsearch.cluster.service
INFO: [Grog the God-Crusher] new_master [Grog the
God-Crusher][kBlV01OYSBuyQvRk3my19w][inet[/192.168.0.101:9300]], reason:
zen-disco-join (elected_as_master)
lut 03, 2013 6:33:40 PM org.elasticsearch.discovery
INFO: [Grog the God-Crusher] elasticsearch/kBlV01OYSBuyQvRk3my19w
lut 03, 2013 6:33:40 PM org.elasticsearch.http
INFO: [Grog the God-Crusher] bound_address {inet[/0:0:0:0:0:0:0:0:9200]},
publish_address {inet[/192.168.0.101:9200]}
lut 03, 2013 6:33:40 PM org.elasticsearch.node
INFO: [Grog the God-Crusher] {0.20.2}[6756]: started
Exception in thread "main"
org.elasticsearch.action.NoShardAvailableActionException: [twitter][3] No
shard available for [[twitter][tweet][2]: routing [null]]

And for example if I will run Java client with more time to Gateway
recover and alocate shards like this:

Node node = nodeBuilder().node();
Client client = node.client();

    Thread.sleep(2000);
    
    GetResponse response = client.prepareGet("twitter", "tweet", "2") 
      .execute()
      .actionGet();

.
.
.
INFO: [Time Bomb] {0.20.2}[6164]: started
lut 03, 2013 6:38:41 PM org.elasticsearch.gateway
INFO: [Time Bomb] recovered [20] indices into cluster_state

I wont get any exception and all will work ok.

Can I use any API to find out when I restart cluster (Gateway recovery) to
check if all alocating shards process is done?
If so I could then execute safely operations like gets and searches
without to be worry about any shard exeption etc.

W dniu sobota, 2 lutego 2013 16:05:01 UTC+1 użytkownik David Pilato
napisał:
Hey,
Look at: https://github.com/https://github.com/elasticsearchfr/hands-on/tree/answers
elasticsearchfr/hands-on/tree/https://github.com/elasticsearchfr/hands-on/tree/answers
answers https://github.com/elasticsearchfr/hands-on/tree/answers

BTW, you have first to create documents before being able to search for
them.

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 2 févr. 2013 à 15:54, JJack_PL jjac...@gmail.com a écrit :

When I use Java client by:
Node node = nodeBuilder().node();
Client client = node.client();
and using this client to "get operation" like:
GetResponse response = client.prepareGet("twitter", "tweet", "1")
.execute()
.actionGet();
or "search operation" like:
SearchResponse response = client.prepareSearch("test")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(termQuery("multi", "test"))
.setFrom(0).setSize(60).setExplain(true)
.execute()
.actionGet();
I got those exceptions:

Exception in thread "main"
org.elasticsearch.action.NoShardAvailableActionException:
[twitter][2] No shard available for [[twitter][tweet][1]: routing [null]]

Exception in thread "main"
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to
execute phase [dfs],
total failure; shardFailures {[na][twitter][0]: No active
shards}{[na][twitter][1]: No active shards}{[na][twitter][2]:
No active shards}{[na][twitter][3]: No active
shards}{[na][twitter][4]: No active shards}

Can I do those gets ans searches by my Java client without running first
ES started in windows?

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/https://groups.google.com/groups/opt_out
groups/opt_out 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 elasticsearc...@googlegroups.com <javascript:>.
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.

But this takes some time (like 30 sec)
Could I make some less drastic requirements and still get the job done?

2013/2/3 Rafał Kuć r.kuc@solr.pl

Hello!

Maybe you can just wait for yellow or green status ? If you can just
execute a code like:

client.admin().cluster().health(new
ClusterHealthRequest().waitForGreenStatus()).actionGet();

*--
Regards,
Rafał Kuć
Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch -
ElasticSearch

I have figured out I can do this gets and searches operations using only
one node created in Java (I use default data node)
but I have to wait after gateway recovery process will end AND until
probably shards will be located in my one node.

So if I will run my Jave client like this:

Node node = nodeBuilder().node();
Client client = node.client();

    GetResponse response = client.prepareGet("twitter", "tweet", "2")
      .execute()
      .actionGet();

I will get this exception ...

lut 03, 2013 6:33:35 PM org.elasticsearch.node
INFO: [Grog the God-Crusher] {0.20.2}[6756]: initializing ...
lut 03, 2013 6:33:35 PM org.elasticsearch.plugins
INFO: [Grog the God-Crusher] loaded [], sites []
lut 03, 2013 6:33:37 PM org.elasticsearch.node
INFO: [Grog the God-Crusher] {0.20.2}[6756]: initialized
lut 03, 2013 6:33:37 PM org.elasticsearch.node
INFO: [Grog the God-Crusher] {0.20.2}[6756]: starting ...
lut 03, 2013 6:33:37 PM org.elasticsearch.transport
INFO: [Grog the God-Crusher] bound_address {inet[/0:0:0:0:0:0:0:0:9300]},
publish_address {inet[/192.168.0.101:9300]}
lut 03, 2013 6:33:40 PM org.elasticsearch.cluster.service
INFO: [Grog the God-Crusher] new_master [Grog the
God-Crusher][kBlV01OYSBuyQvRk3my19w][inet[/192.168.0.101:9300]], reason:
zen-disco-join (elected_as_master)
lut 03, 2013 6:33:40 PM org.elasticsearch.discovery
INFO: [Grog the God-Crusher] elasticsearch/kBlV01OYSBuyQvRk3my19w
lut 03, 2013 6:33:40 PM org.elasticsearch.http
INFO: [Grog the God-Crusher] bound_address {inet[/0:0:0:0:0:0:0:0:9200]},
publish_address {inet[/192.168.0.101:9200]}
lut 03, 2013 6:33:40 PM org.elasticsearch.node
INFO: [Grog the God-Crusher] {0.20.2}[6756]: started
Exception in thread "main"
org.elasticsearch.action.NoShardAvailableActionException: [twitter][3] No
shard available for [[twitter][tweet][2]: routing [null]]

And for example if I will run Java client with more time to Gateway
recover and alocate shards like this:

Node node = nodeBuilder().node();
Client client = node.client();

    Thread.sleep(2000);

    GetResponse response = client.prepareGet("twitter", "tweet", "2")
      .execute()
      .actionGet();

.
.
.
INFO: [Time Bomb] {0.20.2}[6164]: started
lut 03, 2013 6:38:41 PM org.elasticsearch.gateway
INFO: [Time Bomb] recovered [20] indices into cluster_state

I wont get any exception and all will work ok.

Can I use any API to find out when I restart cluster (Gateway recovery) to
check if all alocating shards process is done?
If so I could then execute safely operations like gets and searches
without to be worry about any shard exeption etc.

W dniu sobota, 2 lutego 2013 16:05:01 UTC+1 użytkownik David Pilato
napisał:
Hey,
Look at: https://github.com/https://github.com/elasticsearchfr/hands-on/tree/answers
elasticsearchfr/hands-on/tree/https://github.com/elasticsearchfr/hands-on/tree/answers
answers https://github.com/elasticsearchfr/hands-on/tree/answers

BTW, you have first to create documents before being able to search for
them.

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 2 févr. 2013 à 15:54, JJack_PL jjac...@gmail.com a écrit :

When I use Java client by:
Node node = nodeBuilder().node();
Client client = node.client();
and using this client to "get operation" like:
GetResponse response = client.prepareGet("twitter", "tweet", "1")
.execute()
.actionGet();
or "search operation" like:
SearchResponse response = client.prepareSearch("test")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(termQuery("multi", "test"))
.setFrom(0).setSize(60).setExplain(true)
.execute()
.actionGet();
I got those exceptions:

Exception in thread "main"
org.elasticsearch.action.NoShardAvailableActionException:
[twitter][2] No shard available for [[twitter][tweet][1]: routing [null]]

Exception in thread "main"
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to
execute phase [dfs],
total failure; shardFailures {[na][twitter][0]: No active
shards}{[na][twitter][1]: No active shards}{[na][twitter][2]:
No active shards}{[na][twitter][3]: No active
shards}{[na][twitter][4]: No active shards}

Can I do those gets ans searches by my Java client without running first
ES started in windows?

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/https://groups.google.com/groups/opt_out
groups/opt_out 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.

--
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.

--
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.

Hello!

Look here: http://www.elasticsearch.org/guide/reference/api/admin-cluster-health.html

Basically you have three cluster health status cases - red says not all primary shards are allocated and thus you may experience the exception you saw with no active shards. Than the yellow mean that primary shards are allocated, but one or more replicas are not. The green one means that both primaries and replicas are allocated.

You can set your code to wait for yellow status. However it may take time for ElasticSearch to get to that state and how long depends on your deployment.

--

Regards,

Rafał Kuć

Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch

But this takes some time (like 30 sec)

Could I make some less drastic requirements and still get the job done?

2013/2/3 Rafał Kuć <r.kuc@solr.pl>

Hello!

Maybe you can just wait for yellow or green status ? If you can just execute a code like:

client.admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet();

--

Regards,

Rafał Kuć

Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch

I have figured out I can do this gets and searches operations using only one node created in Java (I use default data node)

but I have to wait after gateway recovery process will end AND until probably shards will be located in my one node.

So if I will run my Jave client like this:

Node node = nodeBuilder().node();

    Client client = node.client();


    


    GetResponse response = client.prepareGet("twitter", "tweet", "2") 


      .execute()


      .actionGet();

I will get this exception ...

lut 03, 2013 6:33:35 PM org.elasticsearch.node

INFO: [Grog the God-Crusher] {0.20.2}[6756]: initializing ...

lut 03, 2013 6:33:35 PM org.elasticsearch.plugins

INFO: [Grog the God-Crusher] loaded [], sites []

lut 03, 2013 6:33:37 PM org.elasticsearch.node

INFO: [Grog the God-Crusher] {0.20.2}[6756]: initialized

lut 03, 2013 6:33:37 PM org.elasticsearch.node

INFO: [Grog the God-Crusher] {0.20.2}[6756]: starting ...

lut 03, 2013 6:33:37 PM org.elasticsearch.transport

INFO: [Grog the God-Crusher] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/192.168.0.101:9300]}

lut 03, 2013 6:33:40 PM org.elasticsearch.cluster.service

INFO: [Grog the God-Crusher] new_master [Grog the God-Crusher][kBlV01OYSBuyQvRk3my19w][inet[/192.168.0.101:9300]], reason: zen-disco-join (elected_as_master)

lut 03, 2013 6:33:40 PM org.elasticsearch.discovery

INFO: [Grog the God-Crusher] elasticsearch/kBlV01OYSBuyQvRk3my19w

lut 03, 2013 6:33:40 PM org.elasticsearch.http

INFO: [Grog the God-Crusher] bound_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish_address {inet[/192.168.0.101:9200]}

lut 03, 2013 6:33:40 PM org.elasticsearch.node

INFO: [Grog the God-Crusher] {0.20.2}[6756]: started

Exception in thread "main" org.elasticsearch.action.NoShardAvailableActionException: [twitter][3] No shard available for [[twitter][tweet][2]: routing [null]]

And for example if I will run Java client with more time to Gateway recover and alocate shards like this:

Node node = nodeBuilder().node();

    Client client = node.client();


    


    Thread.sleep(2000);


    


    GetResponse response = client.prepareGet("twitter", "tweet", "2") 


      .execute()


      .actionGet();

.

.

.

INFO: [Time Bomb] {0.20.2}[6164]: started

lut 03, 2013 6:38:41 PM org.elasticsearch.gateway

INFO: [Time Bomb] recovered [20] indices into cluster_state

I wont get any exception and all will work ok.

Can I use any API to find out when I restart cluster (Gateway recovery) to check if all alocating shards process is done?

If so I could then execute safely operations like gets and searches without to be worry about any shard exeption etc.

W dniu sobota, 2 lutego 2013 16:05:01 UTC+1 użytkownik David Pilato napisał:

Hey,

Look at: https://github.com/elasticsearchfr/hands-on/tree/answers

BTW, you have first to create documents before being able to search for them.

HTH

--

David :wink:

Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 2 févr. 2013 à 15:54, JJack_PL <jjac...@gmail.com> a écrit :

When I use Java client by:

Node node = nodeBuilder().node();

Client client = node.client();

and using this client to "get operation" like:

GetResponse response = client.prepareGet("twitter", "tweet", "1")

      .execute()


      .actionGet();

or "search operation" like:

SearchResponse response = client.prepareSearch("test")

      .setSearchType(SearchType.DFS_QUERY_THEN_FETCH)


      .setQuery(termQuery("multi", "test"))


      .setFrom(0).setSize(60).setExplain(true)


      .execute()


      .actionGet();

I got those exceptions:

Exception in thread "main" org.elasticsearch.action.NoShardAvailableActionException:

[twitter][2] No shard available for [[twitter][tweet][1]: routing [null]]

Exception in thread "main" org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to execute phase [dfs],

total failure; shardFailures {[na][twitter][0]: No active shards}{[na][twitter][1]: No active shards}{[na][twitter][2]:

No active shards}{[na][twitter][3]: No active shards}{[na][twitter][4]: No active shards}

Can I do those gets ans searches by my Java client without running first ES started in windows?

--

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.

--

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.

--

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.

I add to Rafal's answer that you wait for 30s because you are probably using default settings for indexes, 5 shards and 1 replica.
With a single node cluster, your cluster can not move to green because replicas are not allocated on a second node.

Waiting for yellow status will be faster.

Le 3 févr. 2013 à 20:07, Rafał Kuć r.kuc@solr.pl a écrit :

Hello!

Look here: http://www.elasticsearch.org/guide/reference/api/admin-cluster-health.html

Basically you have three cluster health status cases - red says not all primary shards are allocated and thus you may experience the exception you saw with no active shards. Than the yellow mean that primary shards are allocated, but one or more replicas are not. The green one means that both primaries and replicas are allocated.

You can set your code to wait for yellow status. However it may take time for ElasticSearch to get to that state and how long depends on your deployment.

--
Regards,
Rafał Kuć
Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch

But this takes some time (like 30 sec)
Could I make some less drastic requirements and still get the job done?

2013/2/3 Rafał Kuć r.kuc@solr.pl
Hello!

Maybe you can just wait for yellow or green status ? If you can just execute a code like:

client.admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet();

--
Regards,
Rafał Kuć
Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch

I have figured out I can do this gets and searches operations using only one node created in Java (I use default data node)
but I have to wait after gateway recovery process will end AND until probably shards will be located in my one node.

So if I will run my Jave client like this:

Node node = nodeBuilder().node();
Client client = node.client();

    GetResponse response = client.prepareGet("twitter", "tweet", "2") 
      .execute()
      .actionGet();

I will get this exception ...

lut 03, 2013 6:33:35 PM org.elasticsearch.node
INFO: [Grog the God-Crusher] {0.20.2}[6756]: initializing ...
lut 03, 2013 6:33:35 PM org.elasticsearch.plugins
INFO: [Grog the God-Crusher] loaded [], sites []
lut 03, 2013 6:33:37 PM org.elasticsearch.node
INFO: [Grog the God-Crusher] {0.20.2}[6756]: initialized
lut 03, 2013 6:33:37 PM org.elasticsearch.node
INFO: [Grog the God-Crusher] {0.20.2}[6756]: starting ...
lut 03, 2013 6:33:37 PM org.elasticsearch.transport
INFO: [Grog the God-Crusher] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/192.168.0.101:9300]}
lut 03, 2013 6:33:40 PM org.elasticsearch.cluster.service
INFO: [Grog the God-Crusher] new_master [Grog the God-Crusher][kBlV01OYSBuyQvRk3my19w][inet[/192.168.0.101:9300]], reason: zen-disco-join (elected_as_master)
lut 03, 2013 6:33:40 PM org.elasticsearch.discovery
INFO: [Grog the God-Crusher] elasticsearch/kBlV01OYSBuyQvRk3my19w
lut 03, 2013 6:33:40 PM org.elasticsearch.http
INFO: [Grog the God-Crusher] bound_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish_address {inet[/192.168.0.101:9200]}
lut 03, 2013 6:33:40 PM org.elasticsearch.node
INFO: [Grog the God-Crusher] {0.20.2}[6756]: started
Exception in thread "main" org.elasticsearch.action.NoShardAvailableActionException: [twitter][3] No shard available for [[twitter][tweet][2]: routing [null]]

And for example if I will run Java client with more time to Gateway recover and alocate shards like this:

Node node = nodeBuilder().node();
Client client = node.client();

    Thread.sleep(2000);
    
    GetResponse response = client.prepareGet("twitter", "tweet", "2") 
      .execute()
      .actionGet();

.
.
.
INFO: [Time Bomb] {0.20.2}[6164]: started
lut 03, 2013 6:38:41 PM org.elasticsearch.gateway
INFO: [Time Bomb] recovered [20] indices into cluster_state

I wont get any exception and all will work ok.

Can I use any API to find out when I restart cluster (Gateway recovery) to check if all alocating shards process is done?
If so I could then execute safely operations like gets and searches without to be worry about any shard exeption etc.

W dniu sobota, 2 lutego 2013 16:05:01 UTC+1 użytkownik David Pilato napisał:
Hey,
Look at: https://github.com/elasticsearchfr/hands-on/tree/answers

BTW, you have first to create documents before being able to search for them.

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 2 févr. 2013 à 15:54, JJack_PL jjac...@gmail.com a écrit :

When I use Java client by:
Node node = nodeBuilder().node();
Client client = node.client();
and using this client to "get operation" like:
GetResponse response = client.prepareGet("twitter", "tweet", "1")
.execute()
.actionGet();
or "search operation" like:
SearchResponse response = client.prepareSearch("test")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(termQuery("multi", "test"))
.setFrom(0).setSize(60).setExplain(true)
.execute()
.actionGet();
I got those exceptions:

Exception in thread "main" org.elasticsearch.action.NoShardAvailableActionException:
[twitter][2] No shard available for [[twitter][tweet][1]: routing [null]]

Exception in thread "main" org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to execute phase [dfs],
total failure; shardFailures {[na][twitter][0]: No active shards}{[na][twitter][1]: No active shards}{[na][twitter][2]:
No active shards}{[na][twitter][3]: No active shards}{[na][twitter][4]: No active shards}

Can I do those gets ans searches by my Java client without running first ES started in windows?

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.

--
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.

--
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.

--
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.

--
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.

This is my java code :send the value fron jsp page

pojo class code:

log.error("valuse**" +getZname()+" ==> "+getzCurrentLocation()+"
"+getZresumeHeadline());//Here we get the value of all filead

AndFilterBuilder queryFilters = FilterBuilders.andFilter();
queryFilters.add(FilterBuilders.prefixFilter("Education",
getZeducation()));
queryFilters.add(FilterBuilders.prefixFilter("ResumeHeadline",
getZresumeHeadline()));
FilterBuilder aggFilter =
FilterBuilders.andFilter(queryFilters);

        SearchResponse response = client.prepareSearch("res13_index")

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)

.setQuery(QueryBuilders.prefixQuery("Name",getZname()))
.setFilter(aggFilter)

                                        .setFrom(10)
                                        .setSize(60)
                                        .setExplain(true)
                                        .execute()
                                        .actionGet();

Error:
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to
execute phase [dfs], total failure; shardFailures
{[W17rw9RHRyeEZGi-aBVlmQ][res13_index][3]:
SearchParseException[[res13_index][3]: query[Name:null*],from[10],size[60]:
Parse Failure [Failed to parse source
[{"from":10,"size":60,"query":{"prefix":{"Name":null}},"filter":{"and":{"filters":[{"and":{"filters":[{"prefix":{"Education":null}},{"prefix":{"ResumeHeadline":null}}]}}]}},"explain":true}]]];
nested: QueryParsingException[[res13_index] No value specified for prefix
filter]; }{[W17rw9RHRyeEZGi-aBVlmQ][res13_index][2]:
SearchParseException[[res13_index][2]

but when Using static value

AndFilterBuilder queryFilters = FilterBuilders.andFilter();
queryFilters.add(FilterBuilders.prefixFilter("Education","mca));
queryFilters.add(FilterBuilders.prefixFilter("ResumeHeadline",
"developer"));
FilterBuilder aggFilter =
FilterBuilders.andFilter(queryFilters);

        SearchResponse response = client.prepareSearch("res13_index")

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)

.setQuery(QueryBuilders.prefixQuery("Name","mukesh"))
.setFilter(aggFilter)

                                        .setFrom(10)
                                        .setSize(60)
                                        .setExplain(true)
                                        .execute()
                                        .actionGet();

It returns a json list......

--
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.

I answered in the issue 847 you commented:

{"from":10,"size":60,
"query":
{"prefix":{"Name":null}},"filter":{"and":{"filters":[{"and":{"filters":[{"prefix":{"Education":null}},
{"prefix":{"ResumeHeadline":null}}]}}]}},"explain":true}
You can not do a prefixQuery with no value (null). Check your java code: getZeducation() and getZresumeHeadline() return null values.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 25 févr. 2013 à 11:09, MUKESH PANDEY mukeshp073@gmail.com a écrit :

This is my java code :send the value fron jsp page

pojo class code:

log.error("valuse**" +getZname()+" ==> "+getzCurrentLocation()+" "+getZresumeHeadline());//Here we get the value of all filead

AndFilterBuilder queryFilters = FilterBuilders.andFilter();
queryFilters.add(FilterBuilders.prefixFilter("Education", getZeducation()));
queryFilters.add(FilterBuilders.prefixFilter("ResumeHeadline", getZresumeHeadline()));
FilterBuilder aggFilter = FilterBuilders.andFilter(queryFilters);

        SearchResponse response = client.prepareSearch("res13_index")
                                        .setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
                                        .setQuery(QueryBuilders.prefixQuery("Name",getZname()))
                                        .setFilter(aggFilter)
                                    
                                        .setFrom(10)
                                        .setSize(60)
                                        .setExplain(true)
                                        .execute()
                                        .actionGet();

Error:
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to execute phase [dfs], total failure; shardFailures {[W17rw9RHRyeEZGi-aBVlmQ][res13_index][3]: SearchParseException[[res13_index][3]: query[Name:null*],from[10],size[60]: Parse Failure [Failed to parse source [{"from":10,"size":60,"query":{"prefix":{"Name":null}},"filter":{"and":{"filters":[{"and":{"filters":[{"prefix":{"Education":null}},{"prefix":{"ResumeHeadline":null}}]}}]}},"explain":true}]]]; nested: QueryParsingException[[res13_index] No value specified for prefix filter]; }{[W17rw9RHRyeEZGi-aBVlmQ][res13_index][2]: SearchParseException[[res13_index][2]

but when Using static value

AndFilterBuilder queryFilters = FilterBuilders.andFilter();
queryFilters.add(FilterBuilders.prefixFilter("Education","mca));
queryFilters.add(FilterBuilders.prefixFilter("ResumeHeadline", "developer"));
FilterBuilder aggFilter = FilterBuilders.andFilter(queryFilters);

        SearchResponse response = client.prepareSearch("res13_index")
                                        .setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
                                        .setQuery(QueryBuilders.prefixQuery("Name","mukesh"))
                                        .setFilter(aggFilter)
                                    
                                        .setFrom(10)
                                        .setSize(60)
                                        .setExplain(true)
                                        .execute()
                                        .actionGet();

It returns a json list......

--
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.

--
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.

Thanks for Reply

On Mon, Feb 25, 2013 at 4:10 PM, David Pilato david@pilato.fr wrote:

I answered in the issue 847https://github.com/elasticsearch/elasticsearch/issues/847 you
commented:

{"from":10,"size":60,"query":{"prefix":{"Name":null}},"filter":{"and":{"filters":[{"and":{"filters":[{"prefix":{"Education":null}},{"prefix":{"ResumeHeadline":null}}]}}]}},"explain":true}

You can not do a prefixQuery with no value (null). Check your java code:
getZeducation() and getZresumeHeadline() return null values.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 25 févr. 2013 à 11:09, MUKESH PANDEY mukeshp073@gmail.com a écrit :

This is my java code :send the value fron jsp page

pojo class code:

log.error("valuse**" +getZname()+" ==> "+getzCurrentLocation()+"
"+getZresumeHeadline());//Here we get the value of all filead

AndFilterBuilder queryFilters = FilterBuilders.andFilter();
queryFilters.add(FilterBuilders.prefixFilter("Education",
getZeducation()));
queryFilters.add(FilterBuilders.prefixFilter("ResumeHeadline",
getZresumeHeadline()));
FilterBuilder aggFilter =
FilterBuilders.andFilter(queryFilters);

        SearchResponse response = client.prepareSearch("res13_index")

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)

.setQuery(QueryBuilders.prefixQuery("Name",getZname()))
.setFilter(aggFilter)

                                        .setFrom(10)
                                        .setSize(60)
                                        .setExplain(true)
                                        .execute()
                                        .actionGet();

Error:
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed
to execute phase [dfs], total failure; shardFailures
{[W17rw9RHRyeEZGi-aBVlmQ][res13_index][3]:
SearchParseException[[res13_index][3]: query[Name:null*],from[10],size[60]:
Parse Failure [Failed to parse source
[{"from":10,"size":60,"query":{"prefix":{"Name":null}},"filter":{"and":{"filters":[{"and":{"filters":[{"prefix":{"Education":null}},{"prefix":{"ResumeHeadline":null}}]}}]}},"explain":true}]]];
nested: QueryParsingException[[res13_index] No value specified for prefix
filter]; }{[W17rw9RHRyeEZGi-aBVlmQ][res13_index][2]:
SearchParseException[[res13_index][2]

but when Using static value

AndFilterBuilder queryFilters = FilterBuilders.andFilter();

queryFilters.add(FilterBuilders.prefixFilter("Education","mca));
queryFilters.add(FilterBuilders.prefixFilter("ResumeHeadline",
"developer"));
FilterBuilder aggFilter =
FilterBuilders.andFilter(queryFilters);

        SearchResponse response = client.prepareSearch("res13_index")

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)

.setQuery(QueryBuilders.prefixQuery("Name","mukesh"))
.setFilter(aggFilter)

                                        .setFrom(10)
                                        .setSize(60)
                                        .setExplain(true)
                                        .execute()
                                        .actionGet();

It returns a json list......

--
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.

--
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.

--
mukeshp073@gmail.com
Laitkor.pvt ltd

--
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.