org.elasticsearch.action.UnavailableShardsException -
I have to face a similar problem.
I have a master node with config:
cluster.name: Geocoding node. Name: "node 1" node. Master: True Noddata: False Index. Nmr_off_shard: 5 index.number_of_replications: 0 discovery.gov.mm .zen.ping.unicast.hosts: ["localhost"] and a data node with config:
cluster.name: geocoding node Name: "node 2" node. Master: False Noddata: True Index Nmbar_Of_Shores: 5 Index. NMR_F_Replications: 0 Discovery.jpg PMMMMSSSA Enabled: Inaccurate Search. Jen.Ping Unicost Host: ["Localhost"] Both start of the Master End; Data node, 9200 & amp; 9201 resp.
When I connect to the index (using the following source), I found it by mistake (org.elasticsearch.action.UnavailableShardsException).
Source Code:
ImmutableSettings.Builder Builder = ImmutableSettings.settingsBuilder (); Builder. Input ("node. Clint", true); Builder.put ("node.data", false); Builder. Input ("node .name", "node 3"); Builder.put ("cluster.name", "geocoding"); Builder. Input ("discovery.zen.ping.multicast.enabled", "wrong"); Builder.put ("discovery.zen.ping.unicast.hosts", "localhost"); Builder.build (); Node node = nodebuilder Nodbilder () Settings (builder) .node (); Client = node.client (); Print (.client.admin ()) cluster () prepareHealth () setWaitForGreenStatus () execute () () actionGet () ....); It prints: {"cluster_name": "geocoding", "status": "red", "timed_out": true, "Number_of_nodes": 3, "number_of_data_nodes": 1, "active_primary_shards": 4, "active_shards": 4, "relocating_shards": 0, "initial_shards": 0, "assigned_shards": 16}
any suggestions?
Edited: @Andree Stefan: Curl -XGET Localhost: 9200 / _cat / shards? V
Index Shard Prior State Docs Store IP Node India 2p Unregistered India 2R Uncredited India 0 Un Uncredited India 0 Un Uncredited India 3 P Uncredited India 3 R Uncredited India 1 P United Nations 1 India R Uncredited India 4p Uncredited India 4R Unsigned Mite 4P Unsigned Meteate 4R Uncensored Matte 0 P Start 0BB
Exception Expansion: org.elasticsearch.action.UnavailableShardsException: [India] [4] The primary comb is not activated or not known The known node is timeout: [1 m], Request: Index {[x] [y] [1], Source [{"Message": "a",}}}
Edited: Full Source:
< Pre> Hashmap String, string & gt; DocumentMap = new Hashmap (); String id = "1"; String indexing name = "India"; String index type = "address"; ImmutableSettings.Builder Builder = ImmutableSettings.settingsBuilder (); Builder. Input ("node. Clint", true); Builder.put ("node.data", false); Builder. Input ("node .name", "node 3"); Builder.put ("cluster.name", "geocoding"); Builder. Input ("discovery.zen.ping.multicast.enabled", "wrong"); Builder.put ("discovery.zen.ping.unicast.hosts", "localhost"); Builder.build (); Node node = nodebuilder Nodbilder () Settings (builder) .node (); Client Client = node.client (); XContentBuilder contentBuilder = XContentFactory.jsonBuilder (). StartObject (); Iterator & LT; String & gt; Keys = documentMap.keySet (). Iterator (); While (keys.hasNext ()) {string key = keys.next (); ContentBuilder.field (key, documentMap.get (key)); } ContentBuilder.endObject (); Index Response = = client.prepareIndex (IndexName, IndexType, ID) .setSource (contentbuilder). Execute (). Actiongate ();
Comments
Post a Comment