Hi David,i will make it simple.My main moto is using java i want to do CRUD
operations with ElasticSearch,in this process i came to know about
ElasticSearch related Java
Api's URL :
http://www.elasticsearch.org/guide/en/elasticsearch/client/java-api/current/index.html
,from this i followed the steps as it is starting from Maven to Client
Api.I am using Eclipse Kepler and created WebDynamic Project and build the
respective jars,and copied the code from Client Api(Node based and
TransportClient) and execute using JavaApplication i.e.main() which uses
console app i.e. eclipse cmd. so,for now am trying atleast to connect to
Elasticsearch ,after getting this then i will move on with CRUD operations
using JSON. ANY GUIDANCE GIVEN WILL BE HIGHLY APPRECIATED.
URGENT REQUIREMENT.
Thanks in advance.
On Wednesday, March 19, 2014 2:48:37 PM UTC+5:30, Venu Krishna wrote:
>
> Hi can any body give me the code or steps to communicate elasticsearch
> using java.I ahve already created one example,but i am not able to
> understand what it is doing, is there any source code or step by step
> creation of example in eclipse Using Transoprt Client as well as Node .
>
> here is the code which i found in google and try to execute.
>
> import java.util.Date;
> import java.util.HashMap;
> import java.util.Map;
>
> import org.elasticsearch.client.Client;
> import org.elasticsearch.node.Node;
>
> import static org.elasticsearch.node.NodeBuilder.*;
>
> public class PostES {
>
> public static void main (String args[]){
> PostES p = new PostES();
> p.postElasticSearch();
> }
>
>
> public static Map<String, Object> putJsonDocument(String title, String
> content, Date postDate, String author){
>
> Map<String, Object> jsonDocument = new HashMap<String,
> Object>();
>
> jsonDocument.put("title", title);
> jsonDocument.put("conten", content);
> jsonDocument.put("postDate", postDate);
> jsonDocument.put("author", author);
>
> return jsonDocument;
> }
>
>
> private void postElasticSearch(){
>
> Node node = nodeBuilder().node();
> Client client = node.client();
>
> client.prepareIndex("testindex", "article")
> .setSource(putJsonDocument("Example Title",
> "This description is so
> important. You dont even know!",
> new Date(),
> "J.R."))
> .execute().actionGet();
>
> node.close();
> }
>
>
> }
>
> and i am getting errors as
>
> Exception in thread "main"
> 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 PostES.postElasticSearch(PostES.java:33)
> at PostES.main(PostES.java:14)
> 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)
> ... 18 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)
> ... 28 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)
> ... 42 more
>
>
> Thanks in advance.
>
>
--
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/ee2e8cf8-7b69-4493-8e87-c7517be8c4ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.