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<String> hosts = new HashSet<String>();
>   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 <[email protected]> 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 <[email protected]>:
>>>>
>>>>> 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.  
>>>>>>>                              
>>>>>>>
>>>>>>> <dependency>
>>>>>>>     <groupId>org.elasticsearch</groupId>
>>>>>>>
>>>>>>>     <artifactId>elasticsearch</artifactId>
>>>>>>>
>>>>>>>     <version>${es.version}</version>
>>>>>>> </dependency>
>>>>>>>
>>>>>>> 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.<init>(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 
>>>>> [email protected].
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/elasticsearch/bc5accc6-106b-485d-a4da-ad1efed9db74%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/bc5accc6-106b-485d-a4da-ad1efed9db74%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>> 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 [email protected].
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/elasticsearch/e3b85b33-6203-4758-9788-2846e9d69b85%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/e3b85b33-6203-4758-9788-2846e9d69b85%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/6761c3cc-837a-454a-8f3f-46fc7a873007%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to