POM for ElasticSearch 0.17.2


(jabawaba-2) #1

Hi,

I'm new to ElasticSearch and Lucene (2 weeks) and especially to maven
(yesterday). I am writing java proof of concept to learn how to use
ES. I was successful in writing Apache Http Client and Jersey clients
to communicate with ES. The two clients were developed in maven. Now,
I am trying to replicate the effort using the native ES java client
but I am having trouble downloading the ES jars so I can use them to
build my ES java client.

My POM (shown at the end) is having trouble parsing:

org.elasticsearch
elasticsearch
0.17.2

As you can see, I tried both 0.16.0 and 0.17.2 to no avail. Can you
please help/show me how to update my pom in order to get the client to
build on maven.

On a related note, the primary aim of this POC is to figure out how to
access the ES POJOs for both the request and response. In other words,
so far, I have been exchanging JSONs between Jersey and ES.
Consequently, I had to write my own java POJO, and using jackson, to
convert the returned JSON (from ES rest api) to POJO. I found that to
be cumbersome.
Given the following JSON, my guess is that there should be a mapped
POJO in the public ES API
{
"query": {
"filtered" : {
"query" : {
"query_string" : {
"query" : "some query string here"
}
},
"filter" : {
"term" : { "user" : "kimchy" }
}
}
}
}
And conversely, the result set JSON should have it's own public POJO.
Without these public POJOs, I will have to write dozens of POJOs to
represent the various request and response JSONS.

I my guess correct? If so, can you provide me with the package path.

Thank you for taking the time to help me with these two problems.

============================================================


4.0.0



maven2-repository.java.net
Java.net Repository for Maven
http://download.java.net/maven/2/
default


maven-repository.java.net
Java.net Maven 1 Repository (legacy)
http://download.java.net/maven/1
legacy




oss.sonatype.org
OSS Sonatype

true


false

https://oss.sonatype.org/content/repositories/
releases/


sonatype-snapshots
Sonatype Snapshots Repository
http://oss.sonatype.org/content/repositories/
snapshots/

true




com.example.es
es

1.0-SNAPSHOT
es
http://maven.apache.org



org.apache.maven.plugins
maven-compiler-plugin
2.3.2

1.6
1.6

        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.2.1</version>
            <configuration>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</

descriptorRef>


com.example.es.apachehttpclient.Delete

com.example.es.apachehttpclient.Index

com.example.es.apachehttpclient.Search
com.example.es.jersey.Search</
mainClass>





<dependencies>
    <!-- Start ElasticSearch Dependencies -->
    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>0.16.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.lucene</groupId>
        <artifactId>lucene-core</artifactId>
        <version>3.3.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.lucene</groupId>
        <artifactId>lucene-analyzers</artifactId>
        <version>3.3.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.lucene</groupId>
        <artifactId>lucene-snowball</artifactId>
        <version>3.0.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.lucene</groupId>
        <artifactId>lucene-fast-vector-highlighter</artifactId>
        <version>3.0.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.lucene</groupId>
        <artifactId>lucene-highlighter</artifactId>
        <version>2.4.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.lucene</groupId>
        <artifactId>lucene-queries</artifactId>
        <version>2.4.0</version>
    </dependency>
    <!-- End ElasticSearch Dependencies -->
    <!-- Start Jersey Dependencies -->
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-client</artifactId>
        <version>1.8</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey.contribs</groupId>
        <artifactId>jersey-apache-client</artifactId>
        <version>1.8</version>
    </dependency>
    <!-- End Jersey Dependencies -->
    <!-- Start Apache Http Client Dependencies -->
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.1.1</version>
    </dependency>
    <!-- End Apache Http Client Dependencies -->
    <!-- Start JUNIT Dependencies -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.2</version>
        <scope>test</scope>
    </dependency>
    <!-- End JUNIT Dependencies -->
</dependencies>

(Ivan Brusic) #2

Your maven settings look correct, although I am not sure the newlines are
caused by your email editor or not:

...
https://oss.sonatype.org/content/repositories/
releases/
...
http://oss.sonatype.org/content/repositories/
snapshots/
...

Are the newlines after .../repositories/ in the original source? If so,
those are the culprits.

You can see the POMs here:
https://oss.sonatype.org/content/repositories/releases/org/elasticsearch/elasticsearch/

As far as POJOs go, you do have the org.elasticsearch.action.ActionRequest
and org.elasticsearch.action.ActionResponse class hierarchies, however
instances are are probably better created using static factories and
builders and not via a simple constructor.

The actual hits in a SearchResponse are of
type org.elasticsearch.search.SearchHit

BTW, it would be great to have the API online instead of having to point to
source code in github.

--
Ivan

On Tue, Aug 2, 2011 at 8:05 PM, jabawaba sfmo8080@gmail.com wrote:

Hi,

I'm new to ElasticSearch and Lucene (2 weeks) and especially to maven
(yesterday). I am writing java proof of concept to learn how to use
ES. I was successful in writing Apache Http Client and Jersey clients
to communicate with ES. The two clients were developed in maven. Now,
I am trying to replicate the effort using the native ES java client
but I am having trouble downloading the ES jars so I can use them to
build my ES java client.

My POM (shown at the end) is having trouble parsing:

org.elasticsearch
elasticsearch
0.17.2

As you can see, I tried both 0.16.0 and 0.17.2 to no avail. Can you
please help/show me how to update my pom in order to get the client to
build on maven.

On a related note, the primary aim of this POC is to figure out how to
access the ES POJOs for both the request and response. In other words,
so far, I have been exchanging JSONs between Jersey and ES.
Consequently, I had to write my own java POJO, and using jackson, to
convert the returned JSON (from ES rest api) to POJO. I found that to
be cumbersome.
Given the following JSON, my guess is that there should be a mapped
POJO in the public ES API
{
"query": {
"filtered" : {
"query" : {
"query_string" : {
"query" : "some query string here"
}
},
"filter" : {
"term" : { "user" : "kimchy" }
}
}
}
}
And conversely, the result set JSON should have it's own public POJO.
Without these public POJOs, I will have to write dozens of POJOs to
represent the various request and response JSONS.

I my guess correct? If so, can you provide me with the package path.

Thank you for taking the time to help me with these two problems.

============================================================


4.0.0



maven2-repository.java.net
Java.net Repository for Maven
http://download.java.net/maven/2/
default


maven-repository.java.net
Java.net Maven 1 Repository (legacy)
http://download.java.net/maven/1
legacy




oss.sonatype.org
OSS Sonatype

true


false

https://oss.sonatype.org/content/repositories/
releases/


sonatype-snapshots
Sonatype Snapshots Repository
http://oss.sonatype.org/content/repositories/
snapshots/

true




com.example.es
es

1.0-SNAPSHOT
es
http://maven.apache.org



org.apache.maven.plugins
maven-compiler-plugin
2.3.2

1.6
1.6

       <plugin>
           <artifactId>maven-assembly-plugin</artifactId>
           <version>2.2.1</version>
           <configuration>
               <descriptorRefs>
                   <descriptorRef>jar-with-dependencies</

descriptorRef>


com.example.es.apachehttpclient.Delete

com.example.es.apachehttpclient.Index

com.example.es.apachehttpclient.Search
com.example.es.jersey.Search</
mainClass>





org.elasticsearch elasticsearch 0.16.0 org.apache.lucene lucene-core 3.3.0 org.apache.lucene lucene-analyzers 3.3.0 org.apache.lucene lucene-snowball 3.0.3 org.apache.lucene lucene-fast-vector-highlighter 3.0.3 org.apache.lucene lucene-highlighter 2.4.0 org.apache.lucene lucene-queries 2.4.0 com.sun.jersey jersey-client 1.8 com.sun.jersey.contribs jersey-apache-client 1.8 org.apache.httpcomponents httpclient 4.1.1 junit junit 3.8.2 test

(jabawaba-2) #3

Hi Ivan,

Thank you for your reply.

  1. You are correct, my POM doesn't have newlines. I don't know how the
    got inserted. I noticed there was a slash at the end (after releases
    and snapshots). I removed them but made no difference.

    maven2-repository.java.net Java.net Repository for Maven http://download.java.net/maven/2/ default maven-repository.java.net Java.net Maven 1 Repository (legacy) http://download.java.net/maven/1 legacy oss.sonatype.org OSS Sonatype true false https://oss.sonatype.org/content/repositories/

releases


sonatype-snapshots
Sonatype Snapshots Repository
http://oss.sonatype.org/content/repositories/
snapshots

true



  1. Here is my very primitive java client. I'm just trying to test
    whether maven can pick up the ES jars. Apparently it can't.

package com.example.es.es;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.transport.InetSocketTransportAddress;

public class Search {

public static void main(String[] args) {

// on startup

Client client = null;

try {
  client = new TransportClient()
          .addTransportAddress(new

InetSocketTransportAddress("localhost", 9300))
.addTransportAddress(new
InetSocketTransportAddress("localhost", 9300));
// my stuff goes here.
} finally {
// on shutdown
client.close();
}
}
}

  1. And here is the output from mvn compile (I use mvn
    assembly:assembly in order to construct the entire jar w/o
    dependencies, but initially, I want to get compile to work). I noticed
    on repos uses https another uses http. I tried all four combinations
    of http and https to no avail.

$ mvn compile
[INFO] Scanning for projects...
[INFO]

[INFO] Building es
[INFO] task-segment: [compile]
[INFO]

[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (MacRoman actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/admin/dev/
elasticsearch/examples/java/maven/es/src/main/resources
Downloading: http://download.java.net/maven/2//org/elasticsearch/elasticsearch/0.17.2/elasticsearch-0.17.2.pom
[INFO] Unable to find resource 'org.elasticsearch:elasticsearch:pom:
0.17.2' in repository maven2-repository.java.net (http://
download.java.net/maven/2/)
Downloading: http://download.java.net/maven/1/org.elasticsearch/poms/elasticsearch-0.17.2.pom
[INFO] Unable to find resource 'org.elasticsearch:elasticsearch:pom:
0.17.2' in repository maven-repository.java.net (http://
download.java.net/maven/1)
Downloading:
https://oss.sonatype.org/content/repositories/releases/org/elasticsearch/elasticsearch/0.17.2/elasticsearch-0.17.2.pom
[WARNING] Unable to get resource 'org.elasticsearch:elasticsearch:pom:
0.17.2' from repository oss.sonatype.org (https://oss.sonatype.org/
content/repositories/releases): Error transferring file: Operation
timed out
Downloading:
http://oss.sonatype.org/content/repositories/snapshots/org/elasticsearch/elasticsearch/0.17.2/elasticsearch-0.17.2.pom
[WARNING] Unable to get resource 'org.elasticsearch:elasticsearch:pom:
0.17.2' from repository sonatype-snapshots (http://oss.sonatype.org/
content/repositories/snapshots): Error transferring file: Operation
timed out
Downloading: http://repo1.maven.org/maven2/org/elasticsearch/elasticsearch/0.17.2/elasticsearch-0.17.2.pom
[INFO] Unable to find resource 'org.elasticsearch:elasticsearch:pom:
0.17.2' in repository central (http://repo1.maven.org/maven2)
Downloading: http://download.java.net/maven/2//org/elasticsearch/elasticsearch/0.17.2/elasticsearch-0.17.2.jar
[INFO] Unable to find resource 'org.elasticsearch:elasticsearch:jar:
0.17.2' in repository maven2-repository.java.net (http://
download.java.net/maven/2/)
Downloading: http://download.java.net/maven/1/org.elasticsearch/jars/elasticsearch-0.17.2.jar
[INFO] Unable to find resource 'org.elasticsearch:elasticsearch:jar:
0.17.2' in repository maven-repository.java.net (http://
download.java.net/maven/1)
Downloading:
https://oss.sonatype.org/content/repositories/releases/org/elasticsearch/elasticsearch/0.17.2/elasticsearch-0.17.2.jar
[WARNING] Unable to get resource 'org.elasticsearch:elasticsearch:jar:
0.17.2' from repository oss.sonatype.org (https://oss.sonatype.org/
content/repositories/releases): Error transferring file: Operation
timed out
Downloading:
http://oss.sonatype.org/content/repositories/snapshots/org/elasticsearch/elasticsearch/0.17.2/elasticsearch-0.17.2.jar
[WARNING] Unable to get resource 'org.elasticsearch:elasticsearch:jar:
0.17.2' from repository sonatype-snapshots (http://oss.sonatype.org/
content/repositories/snapshots): Error transferring file: Operation
timed out
Downloading: http://repo1.maven.org/maven2/org/elasticsearch/elasticsearch/0.17.2/elasticsearch-0.17.2.jar
[INFO] Unable to find resource 'org.elasticsearch:elasticsearch:jar:
0.17.2' in repository central (http://repo1.maven.org/maven2)
[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] Failed to resolve artifact.

Any help is greatly appreciated.
Thank you

On Aug 2, 8:32 pm, Ivan Brusic i...@brusic.com wrote:

Your maven settings look correct, although I am not sure the newlines are
caused by your email editor or not:

...
https://oss.sonatype.org/content/repositories/
releases/
...
http://oss.sonatype.org/content/repositories/
snapshots/
...

Are the newlines after .../repositories/ in the original source? If so,
those are the culprits.

You can see the POMs here:https://oss.sonatype.org/content/repositories/releases/org/elasticsea...

As far as POJOs go, you do have the org.elasticsearch.action.ActionRequest
and org.elasticsearch.action.ActionResponse class hierarchies, however
instances are are probably better created using static factories and
builders and not via a simple constructor.

The actual hits in a SearchResponse are of
type org.elasticsearch.search.SearchHit

BTW, it would be great to have the API online instead of having to point to
source code in github.

--
Ivan

On Tue, Aug 2, 2011 at 8:05 PM, jabawaba sfmo8...@gmail.com wrote:

Hi,

I'm new to ElasticSearch and Lucene (2 weeks) and especially to maven
(yesterday). I am writing java proof of concept to learn how to use
ES. I was successful in writing Apache Http Client and Jersey clients
to communicate with ES. The two clients were developed in maven. Now,
I am trying to replicate the effort using the native ES java client
but I am having trouble downloading the ES jars so I can use them to
build my ES java client.

My POM (shown at the end) is having trouble parsing:

org.elasticsearch
elasticsearch
0.17.2

As you can see, I tried both 0.16.0 and 0.17.2 to no avail. Can you
please help/show me how to update my pom in order to get the client to
build on maven.

On a related note, the primary aim of this POC is to figure out how to
access the ES POJOs for both the request and response. In other words,
so far, I have been exchanging JSONs between Jersey and ES.
Consequently, I had to write my own java POJO, and using jackson, to
convert the returned JSON (from ES rest api) to POJO. I found that to
be cumbersome.
Given the following JSON, my guess is that there should be a mapped
POJO in the public ES API
{
"query": {
"filtered" : {
"query" : {
"query_string" : {
"query" : "some query string here"
}
},
"filter" : {
"term" : { "user" : "kimchy" }
}
}
}
}
And conversely, the result set JSON should have it's own public POJO.
Without these public POJOs, I will have to write dozens of POJOs to
represent the various request and response JSONS.

I my guess correct? If so, can you provide me with the package path.

Thank you for taking the time to help me with these two problems.

============================================================


4.0.0



maven2-repository.java.net
Java.net Repository for Maven
http://download.java.net/maven/2/
default


maven-repository.java.net
Java.net Maven 1 Repository (legacy)
http://download.java.net/maven/1
legacy




oss.sonatype.org
OSS Sonatype

true


false

https://oss.sonatype.org/content/repositories/
releases/


sonatype-snapshots
Sonatype Snapshots Repository
http://oss.sonatype.org/content/repositories/
snapshots/

true




com.example.es
es

1.0-SNAPSHOT
es
http://maven.apache.org



org.apache.maven.plugins
maven-compiler-plugin
2.3.2

1.6
1.6

       <plugin>
           <artifactId>maven-assembly-plugin</artifactId>
           <version>2.2.1</version>
           <configuration>
               <descriptorRefs>
                   <descriptorRef>jar-with-dependencies</

descriptorRef>


com.example.es.apachehttpclient.Delete

com.example.es.apachehttpclient.Index

com.example.es.apachehttpclient.Search
com.example.es.jersey.Search</
mainClass>





org.elasticsearch elasticsearch 0.16.0 org.apache.lucene lucene-core 3.3.0 org.apache.lucene lucene-analyzers 3.3.0 org.apache.lucene lucene-snowball 3.0.3 org.apache.lucene lucene-fast-vector-highlighter 3.0.3 org.apache.lucene lucene-highlighter 2.4.0 org.apache.lucene lucene-queries 2.4.0 com.sun.jersey jersey-client 1.8 com.sun.jersey.contribs jersey-apache-client 1.8 org.apache.httpcomponents httpclient 4.1.1 junit junit 3.8.2 test

(jabawaba-2) #4

Hi Ivan,

After running it twice with absolutely no changes to the POM or source
code, maven was able to download the jar. Very weird. Can not explain
it.

Thank you for your help.
jabawaba

On Aug 2, 11:20 pm, jabawaba sfmo8...@gmail.com wrote:

Hi Ivan,

Thank you for your reply.

  1. You are correct, my POM doesn't have newlines. I don't know how the
    got inserted. I noticed there was a slash at the end (after releases
    and snapshots). I removed them but made no difference.

    maven2-repository.java.net Java.net Repository for Maven http://download.java.net/maven/2/ default maven-repository.java.net Java.net Maven 1 Repository (legacy) http://download.java.net/maven/1 legacy oss.sonatype.org OSS Sonatype true false https://oss.sonatype.org/content/repositories/

releases


sonatype-snapshots
Sonatype Snapshots Repository
http://oss.sonatype.org/content/repositories/
snapshots

true



  1. Here is my very primitive java client. I'm just trying to test
    whether maven can pick up the ES jars. Apparently it can't.

package com.example.es.es;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.transport.InetSocketTransportAddress;

public class Search {

public static void main(String[] args) {

// on startup

Client client = null;

try {
  client = new TransportClient()
          .addTransportAddress(new

InetSocketTransportAddress("localhost", 9300))
.addTransportAddress(new
InetSocketTransportAddress("localhost", 9300));
// my stuff goes here.
} finally {
// on shutdown
client.close();
}
}

}

  1. And here is the output from mvn compile (I use mvn
    assembly:assembly in order to construct the entire jar w/o
    dependencies, but initially, I want to get compile to work). I noticed
    on repos uses https another uses http. I tried all four combinations
    of http and https to no avail.

$ mvn compile
[INFO] Scanning for projects...
[INFO]

[INFO] Building es
[INFO] task-segment: [compile]
[INFO]

[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (MacRoman actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/admin/dev/
elasticsearch/examples/java/maven/es/src/main/resources
Downloading:http://download.java.net/maven/2//org/elasticsearch/elasticsearch/0.1...
[INFO] Unable to find resource 'org.elasticsearch:elasticsearch:pom:
0.17.2' in repository maven2-repository.java.net (http://
download.java.net/maven/2/)
Downloading:http://download.java.net/maven/1/org.elasticsearch/poms/elasticsearch...
[INFO] Unable to find resource 'org.elasticsearch:elasticsearch:pom:
0.17.2' in repository maven-repository.java.net (http://
download.java.net/maven/1)
Downloading:https://oss.sonatype.org/content/repositories/releases/org/elasticsea...
[WARNING] Unable to get resource 'org.elasticsearch:elasticsearch:pom:
0.17.2' from repository oss.sonatype.org (https://oss.sonatype.org/
content/repositories/releases): Error transferring file: Operation
timed out
Downloading:http://oss.sonatype.org/content/repositories/snapshots/org/elasticsea...
[WARNING] Unable to get resource 'org.elasticsearch:elasticsearch:pom:
0.17.2' from repository sonatype-snapshots (http://oss.sonatype.org/
content/repositories/snapshots): Error transferring file: Operation
timed out
Downloading:http://repo1.maven.org/maven2/org/elasticsearch/elasticsearch/0.17.2/...
[INFO] Unable to find resource 'org.elasticsearch:elasticsearch:pom:
0.17.2' in repository central (http://repo1.maven.org/maven2)
Downloading:http://download.java.net/maven/2//org/elasticsearch/elasticsearch/0.1...
[INFO] Unable to find resource 'org.elasticsearch:elasticsearch:jar:
0.17.2' in repository maven2-repository.java.net (http://
download.java.net/maven/2/)
Downloading:http://download.java.net/maven/1/org.elasticsearch/jars/elasticsearch...
[INFO] Unable to find resource 'org.elasticsearch:elasticsearch:jar:
0.17.2' in repository maven-repository.java.net (http://
download.java.net/maven/1)
Downloading:https://oss.sonatype.org/content/repositories/releases/org/elasticsea...
[WARNING] Unable to get resource 'org.elasticsearch:elasticsearch:jar:
0.17.2' from repository oss.sonatype.org (https://oss.sonatype.org/
content/repositories/releases): Error transferring file: Operation
timed out
Downloading:http://oss.sonatype.org/content/repositories/snapshots/org/elasticsea...
[WARNING] Unable to get resource 'org.elasticsearch:elasticsearch:jar:
0.17.2' from repository sonatype-snapshots (http://oss.sonatype.org/
content/repositories/snapshots): Error transferring file: Operation
timed out
Downloading:http://repo1.maven.org/maven2/org/elasticsearch/elasticsearch/0.17.2/...
[INFO] Unable to find resource 'org.elasticsearch:elasticsearch:jar:
0.17.2' in repository central (http://repo1.maven.org/maven2)
[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] Failed to resolve artifact.

Any help is greatly appreciated.
Thank you

On Aug 2, 8:32 pm, Ivan Brusic i...@brusic.com wrote:

Your maven settings look correct, although I am not sure the newlines are
caused by your email editor or not:

...
https://oss.sonatype.org/content/repositories/
releases/
...
http://oss.sonatype.org/content/repositories/
snapshots/
...

Are the newlines after .../repositories/ in the original source? If so,
those are the culprits.

You can see the POMs here:https://oss.sonatype.org/content/repositories/releases/org/elasticsea...

As far as POJOs go, you do have the org.elasticsearch.action.ActionRequest
and org.elasticsearch.action.ActionResponse class hierarchies, however
instances are are probably better created using static factories and
builders and not via a simple constructor.

The actual hits in a SearchResponse are of
type org.elasticsearch.search.SearchHit

BTW, it would be great to have the API online instead of having to point to
source code in github.

--
Ivan

On Tue, Aug 2, 2011 at 8:05 PM, jabawaba sfmo8...@gmail.com wrote:

Hi,

I'm new to ElasticSearch and Lucene (2 weeks) and especially to maven
(yesterday). I am writing java proof of concept to learn how to use
ES. I was successful in writing Apache Http Client and Jersey clients
to communicate with ES. The two clients were developed in maven. Now,
I am trying to replicate the effort using the native ES java client
but I am having trouble downloading the ES jars so I can use them to
build my ES java client.

My POM (shown at the end) is having trouble parsing:

org.elasticsearch
elasticsearch
0.17.2

As you can see, I tried both 0.16.0 and 0.17.2 to no avail. Can you
please help/show me how to update my pom in order to get the client to
build on maven.

On a related note, the primary aim of this POC is to figure out how to
access the ES POJOs for both the request and response. In other words,
so far, I have been exchanging JSONs between Jersey and ES.
Consequently, I had to write my own java POJO, and using jackson, to
convert the returned JSON (from ES rest api) to POJO. I found that to
be cumbersome.
Given the following JSON, my guess is that there should be a mapped
POJO in the public ES API
{
"query": {
"filtered" : {
"query" : {
"query_string" : {
"query" : "some query string here"
}
},
"filter" : {
"term" : { "user" : "kimchy" }
}
}
}
}
And conversely, the result set JSON should have it's own public POJO.
Without these public POJOs, I will have to write dozens of POJOs to
represent the various request and response JSONS.

I my guess correct? If so, can you provide me with the package path.

Thank you for taking the time to help me with these two problems.

============================================================

<project xmlns="http://maven.apache.org/POM/4.0.0"

...

read more »


(David Pilato) #5

I would suggest to try to modify your sonatype repo settings with :

  <repository>
      <id>oss.sonatype.org</id>
      <name>OSS Sonatype</name>
      <releases>
          <enabled>true</enabled>
      </releases>
      <snapshots>
          <enabled>false</enabled>
      </snapshots>
      <url>http://oss.sonatype.org/content/repositories/

releases/

Note the http instead of https.
If you work from your company network, then you can have proxy problems with https ???

I suppose that you have a message like "could not find jar for ..." ? What is your exact error message ?

Hope this helps.
David :wink:

Le 3 août 2011 à 02:05, jabawaba sfmo8080@gmail.com a écrit :

Hi,

I'm new to ElasticSearch and Lucene (2 weeks) and especially to maven
(yesterday). I am writing java proof of concept to learn how to use
ES. I was successful in writing Apache Http Client and Jersey clients
to communicate with ES. The two clients were developed in maven. Now,
I am trying to replicate the effort using the native ES java client
but I am having trouble downloading the ES jars so I can use them to
build my ES java client.

My POM (shown at the end) is having trouble parsing:

org.elasticsearch
elasticsearch
0.17.2

As you can see, I tried both 0.16.0 and 0.17.2 to no avail. Can you
please help/show me how to update my pom in order to get the client to
build on maven.

On a related note, the primary aim of this POC is to figure out how to
access the ES POJOs for both the request and response. In other words,
so far, I have been exchanging JSONs between Jersey and ES.
Consequently, I had to write my own java POJO, and using jackson, to
convert the returned JSON (from ES rest api) to POJO. I found that to
be cumbersome.
Given the following JSON, my guess is that there should be a mapped
POJO in the public ES API
{
"query": {
"filtered" : {
"query" : {
"query_string" : {
"query" : "some query string here"
}
},
"filter" : {
"term" : { "user" : "kimchy" }
}
}
}
}
And conversely, the result set JSON should have it's own public POJO.
Without these public POJOs, I will have to write dozens of POJOs to
represent the various request and response JSONS.

I my guess correct? If so, can you provide me with the package path.

Thank you for taking the time to help me with these two problems.

============================================================


4.0.0



maven2-repository.java.net
Java.net Repository for Maven
http://download.java.net/maven/2/
default


maven-repository.java.net
Java.net Maven 1 Repository (legacy)
http://download.java.net/maven/1
legacy




oss.sonatype.org
OSS Sonatype

true


false

https://oss.sonatype.org/content/repositories/
releases/


sonatype-snapshots
Sonatype Snapshots Repository
http://oss.sonatype.org/content/repositories/
snapshots/

true




com.example.es
es

1.0-SNAPSHOT
es
http://maven.apache.org



org.apache.maven.plugins
maven-compiler-plugin
2.3.2

1.6
1.6

      <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.2.1</version>
          <configuration>
              <descriptorRefs>
                  <descriptorRef>jar-with-dependencies</

descriptorRef>


com.example.es.apachehttpclient.Delete

com.example.es.apachehttpclient.Index

com.example.es.apachehttpclient.Search
com.example.es.jersey.Search</
mainClass>





org.elasticsearch elasticsearch 0.16.0 org.apache.lucene lucene-core 3.3.0 org.apache.lucene lucene-analyzers 3.3.0 org.apache.lucene lucene-snowball 3.0.3 org.apache.lucene lucene-fast-vector-highlighter 3.0.3 org.apache.lucene lucene-highlighter 2.4.0 org.apache.lucene lucene-queries 2.4.0 com.sun.jersey jersey-client 1.8 com.sun.jersey.contribs jersey-apache-client 1.8 org.apache.httpcomponents httpclient 4.1.1 junit junit 3.8.2 test

(Ivan Brusic) #6

What's that? Maven/ivy download issues? Impossible! That should never
happen.

Oh wait, it does all the time. Repos down, connectivity blips and proxy
issues all contribute to tons of hair pulling when using external dependency
management. If your company is large enough, it might make sense to install
a maven proxy/cache.

--
Ivan

On Wed, Aug 3, 2011 at 2:33 AM, jabawaba sfmo8080@gmail.com wrote:

Hi Ivan,

After running it twice with absolutely no changes to the POM or source
code, maven was able to download the jar. Very weird. Can not explain
it.

Thank you for your help.
jabawaba


(system) #7