Haha!
--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr
Le 21 mars 2014 à 14:27:26, Georgi Ivanov (georgi.r.ivanov@gmail.com) a écrit:
His cluster name is not right , because it is my cluster name
If you did not change the cluster name , it is the default one : elasticsearch
Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "elasticsearch").build();
2014-03-21 12:28 GMT+01:00 David Pilato david@pilato.fr:
Works fine for me.
Either your elasticsearch is not running locally, or your cluster name is not vesseltrackerES or you have some firewall issues.
--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr
Le 21 mars 2014 à 12:02:20, Venu Krishna (yvgk2010@gmail.com) a écrit:
Exceptions and Warnings when i run the above code.
Mar 21, 2014 4:29:53 PM org.elasticsearch.client.transport
WARNING: [Woodgod] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]]
org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9300]][/cluster/nodes/info] disconnected
Mar 21, 2014 4:29:57 PM org.elasticsearch.client.transport
WARNING: [Woodgod] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]]
org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9300]][/cluster/nodes/info] disconnected
Mar 21, 2014 4:29:58 PM org.elasticsearch.client.transport
WARNING: [Woodgod] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]]
org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9300]][/cluster/nodes/info] disconnected
Mar 21, 2014 4:30:02 PM org.elasticsearch.client.transport
WARNING: [Woodgod] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]]
org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9300]][/cluster/nodes/info] disconnected
Mar 21, 2014 4:30:03 PM org.elasticsearch.client.transport
WARNING: [Woodgod] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]]
org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9300]][/cluster/nodes/info] disconnected
Mar 21, 2014 4:30:07 PM org.elasticsearch.client.transport
WARNING: [Woodgod] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]]
org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9300]][/cluster/nodes/info] disconnected
Mar 21, 2014 4:30:08 PM org.elasticsearch.client.transport
WARNING: [Woodgod] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]]
org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9300]][/cluster/nodes/info] disconnected
Mar 21, 2014 4:30:12 PM org.elasticsearch.client.transport
WARNING: [Woodgod] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]]
org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9300]][/cluster/nodes/info] disconnected
Mar 21, 2014 4:30:13 PM org.elasticsearch.client.transport
WARNING: [Woodgod] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]]
org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9300]][/cluster/nodes/info] disconnected
Mar 21, 2014 4:30:17 PM org.elasticsearch.client.transport
WARNING: [Woodgod] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]]
org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9300]][/cluster/nodes/info] disconnected
Mar 21, 2014 4:30:18 PM org.elasticsearch.client.transport
WARNING: [Woodgod] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]]
org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9300]][/cluster/nodes/info] disconnected
Mar 21, 2014 4:30:22 PM org.elasticsearch.client.transport
WARNING: [Woodgod] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]]
org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9300]][/cluster/nodes/info] disconnected
Mar 21, 2014 4:30:23 PM org.elasticsearch.client.transport
WARNING: [Woodgod] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]]
org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9300]][/cluster/nodes/info] disconnected
Mar 21, 2014 4:30:27 PM org.elasticsearch.client.transport
WARNING: [Woodgod] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]]
org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9300]][/cluster/nodes/info] disconnected
Mar 21, 2014 4:30:28 PM org.elasticsearch.client.transport
WARNING: [Woodgod] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]]
org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9300]][/cluster/nodes/info] disconnected
Exception in thread "main" org.elasticsearch.client.transport.NoNodeAvailableException: No node available
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:139)
at org.elasticsearch.client.transport.support.InternalTransportClient.search(InternalTransportClient.java:238)
at org.elasticsearch.client.transport.TransportClient.search(TransportClient.java:300)
at org.elasticsearch.client.action.search.SearchRequestBuilder.doExecute(SearchRequestBuilder.java:579)
at org.elasticsearch.client.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:56)
at org.elasticsearch.client.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:51)
at JavaES_Client.main(JavaES_Client.java:82)
On Friday, March 21, 2014 3:48:44 PM UTC+5:30, David Pilato wrote:
Do this:
public class JavaES_Client {
private static Client client;
private static void buildClient() {
Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "vesseltrackerES").build();
client = new TransportClient(settings)
.addTransportAddress(new InetSocketTransportAddress("localhost", 9300));
}
public static void main(String[] args) {
buildClient();
SearchResponse response = client.prepareSearch().execute().actionGet();
System.out.println("response.getHits().totalHits() = " + response.getHits().totalHits());
}
}
--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr
Le 21 mars 2014 à 11:10:56, Venu Krishna (yvgk...@gmail.com) a écrit:
On Friday, March 21, 2014 3:39:36 PM UTC+5:30, Venu Krishna wrote:
you can find my elasticsearch window i.e overview window and browse window.
my java code you can see below.
from these windows i think you can get what i am doing.
i just create new indexes with type and their id simply .
before this i din't created any cluster or any node e.t.c. ,from my knowledge i have not created,but from ES site i came to know that cluster will be created bydefault and node aswell,but i have not given any cluster name or any specific thing or nodes.
i think i am not making any complication about this.
but to be frank..i am moving here and there like a child to know what is happening.
Java Code
import java.net.InetSocketAddress;
import java.util.HashSet;
import java.util.Set;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
public class JavaES_Client {
Client client;
Set<String> hosts;
void function()
{
//on StartUp
System.out.println("In Function");
client = new TransportClient()
.addTransportAddress(new InetSocketTransportAddress("localhost", 9300));
System.out.println("Connected");
//on ShutDown
client.close();
}
void connectES() {
hosts = new HashSet<String>();
hosts.add("locolhost");
// hosts.add("host2.host1.mydomain.com"); // Make sure this resolvs to proper IP address
Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "vesseltrackerES").build();
TransportClient transportClient = new TransportClient(settings);
for (String host : this.hosts) {
transportClient = transportClient.addTransportAddress(new InetSocketTransportAddress(host, 9200));
}
System.out.print("Connected to nodes : ");
for (DiscoveryNode node : transportClient.connectedNodes()) {
System.out.print(node.getName() + " , ");
}
System.out.println("");
this.client = (Client) transportClient;
}
public static void main(String[] args) {
System.out.println("In Main Method");
JavaES_Client jc = new JavaES_Client();
System.out.println("Object Created");
// jc.function();
jc.connectES();
}
}
On Thursday, March 20, 2014 8:41:08 PM UTC+5:30, Georgi Ivanov wrote:
There is something wrong with your set-up
How many ES node s you have ?
On which IP addresses are ES hosts listening ?
I understood you have 2 hosts , but it seems you have only one on your local machine .
This is the code (a bit modified) I am using at the moment
public void connectES() {
Set hosts = new HashSet();
hosts.add("host1.mydomain.com");
hosts.add("host2.host1.mydomain.com"); // Make sure this resolvs to proper IP address
Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "vesseltrackerES").build();
TransportClient transportClient = new TransportClient(settings);
for (String host : this.hosts) {
transportClient = transportClient.addTransportAddress(new InetSocketTransportAddress(host, 9300));
}
System.out.print("Connected to nodes : ");
for (DiscoveryNode node : transportClient.connectedNodes()) {
System.out.print(node.getHostName() + " , ");
}
System.out.println("");
this.client = (Client) transportClient;
}
On Thursday, March 20, 2014 2:51:50 PM UTC+1, Venu Krishna wrote:
Actually this is my elasticsearch index http://localhost:9200/, as you told i have replaced 9200 with 9300 in the above code ,then i executed the application i am getting following exceptions.
Mar 20, 2014 7:17:45 PM org.elasticsearch.client.transport
WARNING: [Bailey, Gailyn] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]]
org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9300]][/cluster/nodes/info] disconnected
Connected
Mar 20, 2014 7:17:50 PM org.elasticsearch.client.transport
WARNING: [Bailey, Gailyn] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]]
org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9300]][/cluster/nodes/info] disconnected
Mar 20, 2014 7:17:50 PM org.elasticsearch.client.transport
WARNING: [Bailey, Gailyn] failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]]
org.elasticsearch.transport.NodeDisconnectedException: [][inet[localhost/127.0.0.1:9300]][/cluster/nodes/info] disconnected
Thankyou
On Thursday, March 20, 2014 7:12:14 PM UTC+5:30, David Pilato wrote:
Use port 9300
--
David
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
Le 20 mars 2014 à 14:34, Venu Krishna yvgk...@gmail.com a écrit :
Thankyou for the reply.I am not getting any errors,but i am not able to connect to my elasticsearch using java.Here my code.
import java.net.InetSocketAddress;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
public class JavaES_Client {
void function()
{
//on StartUp
System.out.println("In Function");
Client client = new TransportClient()
.addTransportAddress(new InetSocketTransportAddress("localhost", 9200)); // This is where my control is getting stuck,without any exceptions or errors.
System.out.println("Connected");
//on ShutDown
client.close();
}
public static void main(String[] args) {
System.out.println("In Main Method");
JavaES_Client jc = new JavaES_Client();
System.out.println("Object Created");
jc.function();
}
}
On Thursday, March 20, 2014 2:20:25 PM UTC+5:30, Georgi Ivanov wrote:
On Linux the file is /etc/hosts
On Windows c:\windows\system32\drivers\etc\hosts
Open the file in text editor
Add following lines:
192.168.1.100 host1
192.168.1.101 host2
Make sure that 192.168.1.100/101 is the right IP address of the host1/host2
2014-03-20 8:35 GMT+01:00 Venu Krishna yvgk...@gmail.com:
Hi Georgi Ivanov,
yes,i am able to understand the Exception i.e. UnresolvedAddressException,but you are telling that to make sure host1 and host2 are resolved by adding entries to /etc/hosts to wherever the file in on Windows,for this can you give me the steps how to approach this.Sorry i am new to this and am learning i am unable to get the proper example.Thanks in advance for the help.
On Thursday, March 20, 2014 2:36:10 AM UTC+5:30, Georgi Ivanov wrote:
Well
I think UnresolvedAddressException obviously means that your Java client can not resolve host1 and host2
make sure host1 and host2 are resolvable by adding entries to /etc/hosts ot wherever the file in on Windows
On Friday, March 14, 2014 1:47:02 PM UTC+1, Venu Krishna wrote:
Hi,
I am Y.Venu,i am totally new to this elasticsearch,now i am trying to communicate java elastisearch,i have gone through the elasticsearch java api's
1st i came across maven repositry.
i have created pom.xml in my eclipse and in the dependency tag i have just placed the code that i found in maven repositry
i.e.
org.elasticsearch
elasticsearch
${es.version}
After that i have created one class with the main method and i copied and placed the code that i found in the client api of elasticsearch i.e.
TransportClient.
main()
{
Client client = new TransportClient()
.addTransportAddress(new InetSocketTransportAddress("host1", 9200))
.addTransportAddress(new InetSocketTransportAddress("host2", 9200));
// on shutdown
client.close();
Settings settings = ImmutableSettings.settingsBuilder()
.put("client.transport.sniff", true).build();
TransportClient client1 = new TransportClient(settings);
}
After running this app javapplication,i am getting the errors like this
In Main Method
Mar 14, 2014 6:05:24 PM org.elasticsearch.node
INFO: [Mister Machine] {elasticsearch/0.16.1}[11016]: initializing ...
Mar 14, 2014 6:05:24 PM org.elasticsearch.plugins
INFO: [Mister Machine] loaded []
org.elasticsearch.common.inject.internal.ComputationException: org.elasticsearch.common.inject.internal.ComputationException: java.lang.NoClassDefFoundError: Lorg/apache/lucene/store/Lock;
at org.elasticsearch.common.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:553)
at org.elasticsearch.common.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:419)
at org.elasticsearch.common.inject.internal.CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
at org.elasticsearch.common.inject.internal.FailableCache.get(FailableCache.java:46)
at org.elasticsearch.common.inject.ConstructorInjectorStore.get(ConstructorInjectorStore.java:52)
at org.elasticsearch.common.inject.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:57)
at org.elasticsearch.common.inject.InjectorImpl.initializeBinding(InjectorImpl.java:377)
at org.elasticsearch.common.inject.BindingProcessor$1$1.run(BindingProcessor.java:169)
at org.elasticsearch.common.inject.BindingProcessor.initializeBindings(BindingProcessor.java:224)
at org.elasticsearch.common.inject.InjectorBuilder.initializeStatically(InjectorBuilder.java:120)
at org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:105)
at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:92)
at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:69)
at org.elasticsearch.common.inject.ModulesBuilder.createInjector(ModulesBuilder.java:58)
at org.elasticsearch.node.internal.InternalNode.(InternalNode.java:146)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)
at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:166)
at ES_Client.main(ES_Client.java:64)
Caused by: org.elasticsearch.common.inject.internal.ComputationException: java.lang.NoClassDefFoundError: Lorg/apache/lucene/store/Lock;
at org.elasticsearch.common.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:553)
at org.elasticsearch.common.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:419)
at org.elasticsearch.common.inject.internal.CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
at org.elasticsearch.common.inject.internal.FailableCache.get(FailableCache.java:46)
at org.elasticsearch.common.inject.MembersInjectorStore.get(MembersInjectorStore.java:66)
at org.elasticsearch.common.inject.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:69)
at org.elasticsearch.common.inject.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:31)
at org.elasticsearch.common.inject.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:39)
at org.elasticsearch.common.inject.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:35)
at org.elasticsearch.common.inject.internal.FailableCache$1.apply(FailableCache.java:35)
at org.elasticsearch.common.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:549)
... 17 more
Caused by: java.lang.NoClassDefFoundError: Lorg/apache/lucene/store/Lock;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.lang.Class.getDeclaredFields(Unknown Source)
at org.elasticsearch.common.inject.spi.InjectionPoint$Factory$1.getMembers(InjectionPoint.java:386)
at org.elasticsearch.common.inject.spi.InjectionPoint$Factory$1.getMembers(InjectionPoint.java:384)
at org.elasticsearch.common.inject.spi.InjectionPoint.addInjectorsForMembers(InjectionPoint.java:359)
at org.elasticsearch.common.inject.spi.InjectionPoint.addInjectionPoints(InjectionPoint.java:353)
at org.elasticsearch.common.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:295)
at org.elasticsearch.common.inject.MembersInjectorStore.createWithListeners(MembersInjectorStore.java:78)
at org.elasticsearch.common.inject.MembersInjectorStore.access$000(MembersInjectorStore.java:35)
at org.elasticsearch.common.inject.MembersInjectorStore$1.create(MembersInjectorStore.java:43)
at org.elasticsearch.common.inject.MembersInjectorStore$1.create(MembersInjectorStore.java:40)
at org.elasticsearch.common.inject.internal.FailableCache$1.apply(FailableCache.java:35)
at org.elasticsearch.common.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:549)
... 27 more
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.store.Lock
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 41 more
from this i came to know that there is problem in Maven Repositry,but i checked the maven,i din't find nay issues.
Was i am in the correct path to get the communication from java to elasticsearch.do i need to set any classpath or path related to elastic search.
any basic application so that i can look and get some idea.
URGENT PLZ
Thanks in advance.
Regards Venu.Y
--
You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elasticsearch/X6dmbQE7pFc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elasticsearc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/bc5accc6-106b-485d-a4da-ad1efed9db74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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.
You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elasticsearch/X6dmbQE7pFc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/etPan.532c2270.6b8b4567.db6a%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/d/optout.
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGKxwgkhYBvm_K30LBc7kgH%3DB-iGfvCe9_o1nJGPUgrm-1ZK7A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/etPan.532c4f3c.74b0dc51.db6a%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/d/optout.