How to elasticsearch + scala Lift


(Sanx El Santo) #1

Greetings to all

I am developing on Lift which is a framework for Scala, and I want to use
elasticsearch

My first step was the installation of elasticsearch, according to the
following doc

http://www.elasticsearch.org/guide/reference/setup/installation.html

and the result was as follows:

http://localhost:9200/

{
"ok": true,
"status": 200,
"name": "Tailhook"
"version": {
"number": "0.19.3"
"snapshot_build": false
}
"tagline", "You Know, for Search"
}

My questions are:

  1. To use elasticsearch in my project, I have to use this repository?

http://mvnrepository.com/artifact/org.fusesource.insight/insight-elasticsearch/1.1

or what would be the next step?

  1. Anyone have any example or code that can be shared for reference.

Thank you all for your attention


(Shay Banon) #2

You mean using elasticsearch on the JVM? There are docs and maven repo
here: http://www.elasticsearch.org/guide/reference/java-api/.

On Wed, May 9, 2012 at 6:46 PM, Sanx El Santo hectorgool@gmail.com wrote:

Greetings to all

I am developing on Lift which is a framework for Scala, and I want to use
elasticsearch

My first step was the installation of elasticsearch, according to the
following doc

http://www.elasticsearch.org/guide/reference/setup/installation.html

and the result was as follows:

http://localhost:9200/

{
"ok": true,
"status": 200,
"name": "Tailhook"
"version": {
"number": "0.19.3"
"snapshot_build": false
}
"tagline", "You Know, for Search"
}

My questions are:

  1. To use elasticsearch in my project, I have to use this repository?

http://mvnrepository.com/artifact/org.fusesource.insight/insight-elasticsearch/1.1

or what would be the next step?

  1. Anyone have any example or code that can be shared for reference.

Thank you all for your attention


(benny.sadeh) #3

there's also scalastic: https://github.com/bsadeh/scalastic, a scala
api built on top of the java api

On May 13, 2:35 am, Shay Banon kim...@gmail.com wrote:

You mean using elasticsearch on the JVM? There are docs and maven repo
here:http://www.elasticsearch.org/guide/reference/java-api/.

On Wed, May 9, 2012 at 6:46 PM, Sanx El Santo hectorg...@gmail.com wrote:

Greetings to all

I am developing on Lift which is a framework for Scala, and I want to use
elasticsearch

My first step was the installation of elasticsearch, according to the
following doc

http://www.elasticsearch.org/guide/reference/setup/installation.html

and the result was as follows:

http://localhost:9200/

{
"ok": true,
"status": 200,
"name": "Tailhook"
"version": {
"number": "0.19.3"
"snapshot_build": false
}
"tagline", "You Know, for Search"
}

My questions are:

  1. To use elasticsearch in my project, I have to use this repository?

http://mvnrepository.com/artifact/org.fusesource.insight/insight-elas...

or what would be the next step?

  1. Anyone have any example or code that can be shared for reference.

Thank you all for your attention


(Brad Hunter) #4

Benny, did you push scalastic to a repository anywhere? I couldn't find
it. I want to integrate the dependency in sbt.

Thanks!

On Monday, May 14, 2012 3:39:05 AM UTC-4, benny.sadeh wrote:

there's also scalastic: https://github.com/bsadeh/scalastic, a scala
api built on top of the java api

On May 13, 2:35 am, Shay Banon kim...@gmail.com wrote:

You mean using elasticsearch on the JVM? There are docs and maven repo
here:http://www.elasticsearch.org/guide/reference/java-api/.

On Wed, May 9, 2012 at 6:46 PM, Sanx El Santo hectorg...@gmail.com
wrote:

Greetings to all

I am developing on Lift which is a framework for Scala, and I want to
use

elasticsearch

My first step was the installation of elasticsearch, according to the
following doc

http://www.elasticsearch.org/guide/reference/setup/installation.html

and the result was as follows:

http://localhost:9200/

{
"ok": true,
"status": 200,
"name": "Tailhook"
"version": {
"number": "0.19.3"
"snapshot_build": false
}
"tagline", "You Know, for Search"
}

My questions are:

  1. To use elasticsearch in my project, I have to use this repository?

http://mvnrepository.com/artifact/org.fusesource.insight/insight-elas...

or what would be the next step?

  1. Anyone have any example or code that can be shared for reference.

Thank you all for your attention


(benny.sadeh) #5

Hey Brad,
you can get the source from github at https://github.com/bsadeh/scalastic
or the built artifacts from our nexus repository at
http://repository.traackr.com/nexus/index.html#nexus-search;quick~scalastic

I have a start of the sbt integration, but it can be updated ...
I suggest you clone the git repo and submit a pull request once you're
done. others will be thankful for your efforts :wink:

Thank, in advance :slight_smile:

On May 19, 6:56 am, Brad Hunter bhunt...@gmail.com wrote:

Benny, did you push scalastic to a repository anywhere? I couldn't find
it. I want to integrate the dependency in sbt.

Thanks!


(Anne Veling) #6

Hi Brad

The scalastic API looks great. Was trying to start using it for our
project, but the repository you supplied is not open, it requires a
username/pw

When I cloned the github repo, I could build locally, but when I run
the tests in sbt, I get failures all over:

info] SimpleChildQuerySearchTest:
[info] Exception encountered when attempting to run a suite with class
name: com.traackr.scalastic.elasticsearch.SimpleChildQuerySearchTest
*** ABORTED ***
[info] org.elasticsearch.indices.IndexMissingException:
[simplequerytest] missing
[info] at
org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:
477)
[info] at
org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:
268)

And many more like these. Something going wrong with the index
creation code at the start of the tests?

Anne

On May 25, 1:29 am, "benny.sadeh" benny.sa...@gmail.com wrote:

Hey Brad,
you can get the source from github athttps://github.com/bsadeh/scalastic
or the built artifacts from our nexus repository athttp://repository.traackr.com/nexus/index.html#nexus-search;quick~sca...

I have a start of the sbt integration, but it can be updated ...
I suggest you clone the git repo and submit a pull request once you're
done. others will be thankful for your efforts :wink:

Thank, in advance :slight_smile:

On May 19, 6:56 am, Brad Hunter bhunt...@gmail.com wrote:

Benny, did you pushscalasticto a repository anywhere? I couldn't find
it. I want to integrate the dependency in sbt.

Thanks!


(benny.sadeh) #7

hi Anne, I think you meant to say: "Hi Benny" :wink:

my bad, you are right: that repository is not public. I will look into
how to provide the packaged artifacts via github.

however, when running "mvn clean install" I get the following
successful report. so I'm wondering what is different for you; what do
you use as the installation command?


[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective
model for com.traackr:traackr-scalastic:jar:0.0.5-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.scala-tools:maven-
scala-plugin is missing. @ line 94, column 18
[WARNING]
[WARNING] It is highly recommended to fix these problems because they
threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer
support building such malformed projects.
[WARNING]
[INFO]
[INFO]

[INFO] Building Scalastic 0.0.5-SNAPSHOT
[INFO]

Downloading: http://repository.traackr.com/nexus/content/groups/public/org/scala-tools/maven-scala-plugin/maven-metadata.xml
Downloaded: http://repository.traackr.com/nexus/content/groups/public/org/scala-tools/maven-scala-plugin/maven-metadata.xml
(2 KB at 0.4 KB/sec)
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @
traackr-scalastic ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @
traackr-scalastic ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-scala-plugin:2.15.2:compile (default) @ traackr-
scalastic ---
[INFO] Checking for multiple versions of scala
[INFO] includes = [/*.scala,/.java,]
[INFO] excludes = []
[INFO] /Users/benny/git/scalastic/src/main/scala:-1: info: compiling
[INFO] Compiling 10 source files to /Users/benny/git/scalastic/target/
classes at 1339307171198
[INFO] prepare-compile in 0 s
[INFO] compile in 16 s
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-
testResources) @ traackr-scalastic ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-
testCompile) @ traackr-scalastic ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-scala-plugin:2.15.2:testCompile (default) @ traackr-
scalastic ---
[INFO] Checking for multiple versions of scala
[INFO] includes = [**/
.scala,**/*.java,]
[INFO] excludes = []
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ traackr-
scalastic ---
[INFO] Surefire report directory: /Users/benny/git/scalastic/target/
surefire-reports


T E S T S

Running com.traackr.scalastic.elasticsearch.ParentChildQueryTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.64
sec
Running com.traackr.scalastic.elasticsearch.SimpleChildQuerySearchTest
22:46:34 [main] WARN c.t.s.e.SimpleChildQuerySearchTest - Failed
shards:
22:46:34 [main] WARN c.t.s.e.SimpleChildQuerySearchTest - -> shard
[[2][simplechildquerysearchtest][0]], reason
[SearchParseException[[simplechildquerysearchtest][0]:
from[-1],size[-1]: Parse Failure [Failed to parse source [na]]];
nested: QueryParsingException[[simplechildquerysearchtest] No mapping
for for type [child]]; ]
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.772
sec
Running com.traackr.scalastic.elasticsearch.SimpleFieldsTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.319
sec
Running com.traackr.scalastic.elasticsearch.SimpleQueryTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.156
sec
Running com.traackr.scalastic.elasticsearch.SimpleSearchTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.222
sec

Results :

Tests run: 27, Failures: 0, Errors: 0, Skipped: 0

[INFO]

[INFO] BUILD SUCCESS
[INFO]

[INFO] Total time: 36.906s
[INFO] Finished at: Sat Jun 09 22:46:41 PDT 2012
[INFO] Final Memory: 8M/81M
[INFO]

Bennys-Mac:scalastic benny$ mvn clean install
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective
model for com.traackr:traackr-scalastic:jar:0.0.5-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.scala-tools:maven-
scala-plugin is missing. @ line 94, column 18
[WARNING]
[WARNING] It is highly recommended to fix these problems because they
threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer
support building such malformed projects.
[WARNING]
[INFO]
[INFO]

[INFO] Building Scalastic 0.0.5-SNAPSHOT
[INFO]

[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ traackr-
scalastic ---
[INFO] Deleting /Users/benny/git/scalastic/target
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @
traackr-scalastic ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @
traackr-scalastic ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-scala-plugin:2.15.2:compile (default) @ traackr-
scalastic ---
[INFO] Checking for multiple versions of scala
[INFO] includes = [/*.scala,/.java,]
[INFO] excludes = []
[INFO] /Users/benny/git/scalastic/src/main/scala:-1: info: compiling
[INFO] Compiling 10 source files to /Users/benny/git/scalastic/target/
classes at 1339307368634
[INFO] prepare-compile in 0 s
[INFO] compile in 21 s
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-
testResources) @ traackr-scalastic ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-
testCompile) @ traackr-scalastic ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-scala-plugin:2.15.2:testCompile (default) @ traackr-
scalastic ---
[INFO] Checking for multiple versions of scala
[INFO] includes = [**/
.scala,**/*.java,]
[INFO] excludes = []
[INFO] /Users/benny/git/scalastic/src/test/scala:-1: info: compiling
[INFO] Compiling 6 source files to /Users/benny/git/scalastic/target/
test-classes at 1339307390013
[INFO] prepare-compile in 0 s
[INFO] compile in 25 s
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ traackr-
scalastic ---
[INFO] Surefire report directory: /Users/benny/git/scalastic/target/
surefire-reports


T E S T S

Running com.traackr.scalastic.elasticsearch.ParentChildQueryTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.52
sec
Running com.traackr.scalastic.elasticsearch.SimpleChildQuerySearchTest
22:50:24 [main] WARN c.t.s.e.SimpleChildQuerySearchTest - Failed
shards:
22:50:24 [main] WARN c.t.s.e.SimpleChildQuerySearchTest - -> shard
[[2][simplechildquerysearchtest][0]], reason
[SearchParseException[[simplechildquerysearchtest][0]:
from[-1],size[-1]: Parse Failure [Failed to parse source [na]]];
nested: QueryParsingException[[simplechildquerysearchtest] No mapping
for for type [child]]; ]
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.719
sec
Running com.traackr.scalastic.elasticsearch.SimpleFieldsTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.501
sec
Running com.traackr.scalastic.elasticsearch.SimpleQueryTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.152
sec
Running com.traackr.scalastic.elasticsearch.SimpleSearchTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.198
sec

Results :

Tests run: 27, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ traackr-
scalastic ---
[INFO] Building jar: /Users/benny/git/scalastic/target/traackr-
scalastic-0.0.5-SNAPSHOT.jar
[INFO]
[INFO] --- maven-jar-plugin:2.3.1:test-jar (default) @ traackr-
scalastic ---
[INFO] Building jar: /Users/benny/git/scalastic/target/traackr-
scalastic-0.0.5-SNAPSHOT-tests.jar
[INFO]
[INFO] --- maven-source-plugin:2.1.2:jar-no-fork (attach-sources) @
traackr-scalastic ---
[INFO] Building jar: /Users/benny/git/scalastic/target/traackr-
scalastic-0.0.5-SNAPSHOT-sources.jar
[INFO]
[INFO] --- maven-source-plugin:2.1.2:test-jar-no-fork (attach-sources)
@ traackr-scalastic ---
[INFO] Building jar: /Users/benny/git/scalastic/target/traackr-
scalastic-0.0.5-SNAPSHOT-test-sources.jar
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @
traackr-scalastic ---
[INFO] Installing /Users/benny/git/scalastic/target/traackr-
scalastic-0.0.5-SNAPSHOT.jar to /Users/benny/.m2/repository/com/
traackr/traackr-scalastic/0.0.5-SNAPSHOT/traackr-scalastic-0.0.5-
SNAPSHOT.jar
[INFO] Installing /Users/benny/git/scalastic/pom.xml to /Users/
benny/.m2/repository/com/traackr/traackr-scalastic/0.0.5-SNAPSHOT/
traackr-scalastic-0.0.5-SNAPSHOT.pom
[INFO] Installing /Users/benny/git/scalastic/target/traackr-
scalastic-0.0.5-SNAPSHOT-tests.jar to /Users/benny/.m2/repository/com/
traackr/traackr-scalastic/0.0.5-SNAPSHOT/traackr-scalastic-0.0.5-
SNAPSHOT-tests.jar
[INFO] Installing /Users/benny/git/scalastic/target/traackr-
scalastic-0.0.5-SNAPSHOT-sources.jar to /Users/benny/.m2/repository/
com/traackr/traackr-scalastic/0.0.5-SNAPSHOT/traackr-scalastic-0.0.5-
SNAPSHOT-sources.jar
[INFO] Installing /Users/benny/git/scalastic/target/traackr-
scalastic-0.0.5-SNAPSHOT-test-sources.jar to /Users/benny/.m2/
repository/com/traackr/traackr-scalastic/0.0.5-SNAPSHOT/traackr-
scalastic-0.0.5-SNAPSHOT-test-sources.jar
[INFO]

[INFO] BUILD SUCCESS
[INFO]

[INFO] Total time: 1:06.903s
[INFO] Finished at: Sat Jun 09 22:50:32 PDT 2012
[INFO] Final Memory: 7M/81M
[INFO]

On Jun 7, 4:32 am, Anne Veling a...@beyondtrees.com wrote:

Hi Brad

The scalastic API looks great. Was trying to start using it for our
project, but the repository you supplied is not open, it requires a
username/pw

When I cloned the github repo, I could build locally, but when I run
the tests in sbt, I get failures all over:

info] SimpleChildQuerySearchTest:
[info] Exception encountered when attempting to run a suite with class
name: com.traackr.scalastic.elasticsearch.SimpleChildQuerySearchTest
*** ABORTED ***
[info] org.elasticsearch.indices.IndexMissingException:
[simplequerytest] missing
[info] at
org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:
477)
[info] at
org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:
268)

And many more like these. Something going wrong with the index
creation code at the start of the tests?

Anne

On May 25, 1:29 am, "benny.sadeh" benny.sa...@gmail.com wrote:


(system) #8