Lucene queries

Hi,

I have been reading the documentation and doing a lot of tests but I can not get an answer to this.

I need to integrate an application that uses Lucene as search engine with Elastic Search. I already can write in my Elastic Search cluster, but the searches are much more difficult. I have a lot of complex Lucene queries that I am trying to pass to Elastic Search but they didn't work.

Is it possible to pass directly a Lucene query to Elastic Search? If yes, how? If not, what should I do in order to get that?

Thanks!!!

I assume that you are using Java.
Did you look at this?

and this?

Does it help?

David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 13 févr. 2013 à 15:23, elastray adelpozo@xtivia.com a écrit :

Hi,

I have been reading the documentation and doing a lot of tests but I can not
get an answer to this.

I need to integrate an application that uses Lucene as search engine with
Elastic Search. I already can write in my Elastic Search cluster, but the
searches are much more difficult. I have a lot of complex Lucene queries
that I am trying to pass to Elastic Search but they didn't work.

Is it possible to pass directly a Lucene query to Elastic Search? If yes,
how? If not, what should I do in order to get that?

Thanks!!!

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Lucene-queries-tp4029770.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

You can a use query_string query.

On Wednesday, February 13, 2013 9:23:29 AM UTC-5, elastray wrote:

Hi,

I have been reading the documentation and doing a lot of tests but I can
not
get an answer to this.

I need to integrate an application that uses Lucene as search engine with
Elastic Search. I already can write in my Elastic Search cluster, but the
searches are much more difficult. I have a lot of complex Lucene queries
that I am trying to pass to Elastic Search but they didn't work.

Is it possible to pass directly a Lucene query to Elastic Search? If yes,
how? If not, what should I do in order to get that?

Thanks!!!

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Lucene-queries-tp4029770.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hi dadoonet,

and thanks for your response!

You assume well, I am using java. And Jest to talk to Elastic Search cluster.

I am testing that right now, but I am not sure that it is what I am looking for. For what I understand, I think that I have to understand the queries, translate them into Elastic Search nomenclature and then use Jest or the Java API to execute them, isn't it? Is there any other way to do that?

Regards!

I see. I don't know the JEST API.
The links I gave are related to Elasticsearch Java client (using transport network layer, 9300-9399 ports and not REST API, 9200-9299 ports).

Whatever the Java client you use, you have to find the right query for your use case.

Have a look at Elasticsearch Platform — Find real-time answers at scale | Elastic to find the API that suits you the more.

HTH

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 13 févr. 2013 à 15:39, elastray adelpozo@xtivia.com a écrit :

Hi dadoonet,

and thanks for your response!

You assume well, I am using java. And Jest to talk to Elastic Search
cluster.

I am testing that right now, but I am not sure that it is what I am looking
for. For what I understand, I think that I have to understand the queries,
translate them into Elastic Search nomenclature and then use Jest or the
Java API to execute them, isn't it? Is there any other way to do that?

Regards!

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Lucene-queries-tp4029770p4029773.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Thanks Jerome, I already have been reading that, but I don't know how to use it. Right now I am trying to use a Lucene's BooleanQuery and it is being impossible, so I suppose that I would have to read every query and transform it, isn't it?

Regards!

If you are using a boolean query that already has some clauses in it, you
could just add a must clause to your query with the querystringquery inside
containing tjhe lucene query.

Or if you already have a lucene query built, you could simply replace your
booleanquery with the querystringquery containing the lucene query itself.

On Wednesday, February 13, 2013 9:54:47 AM UTC-5, elastray wrote:

Thanks Jerome, I already have been reading that, but I don't know how to
use
it. Right now I am trying to use a Lucene's BooleanQuery and it is being
impossible, so I suppose that I would have to read every query and
transform
it, isn't it?

Regards!

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Lucene-queries-tp4029770p4029775.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Or if you already have a lucene query built, you could simply replace your booleanquery with the querystringquery containing the lucene query itself.

That would be great!! I will try it, but do you have a small example?

Thanks!!!

Perhaps I didn't explain myself... I do not have something like "fist AND second", I do have something like this after searching for "test" in the App:

+( +(company:14) +( (+(name:book)) (+(+(name:post) +(user:16 (role:10 groupRole:10-190)))) (+(+(name:file) +(user:16 (role:10 groupRole:10-190))) +(status:0)) ) ) +(content:test description:test properties:test)

Of course, if I send that to Elastic Search it doesn't works, and I do not see how to translate that... I am not really sure about that but looking into the app code it seems that is the Lucene query... does it makes sense?

Thanks!!

Anyone knows why that is working with Solr and not with Elastic Search?

Thanks!!!

I think this should work if you wrap this around a QueryStringQuery as your
query, no ? You could try putting it to the q parameter while calling the
rest API

On Wednesday, February 13, 2013 11:31:39 AM UTC-5, elastray wrote:

Anyone knows why that is working with Solr and not with Elastic Search?

Thanks!!!

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Lucene-queries-tp4029770p4029784.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Thanks Jerome!!!

I tried this (using Jest, you know...):

Search search = new Search(Search.createQueryWithBuilder(QueryBuilders.queryString(translatedQuery.toString()).toString()));

where translatedQuery is my original query, and I am not sure if it works but I get something different this time :). And different is good when you are stuck :D.

I will investigate this and let you know if it works!! (first I have to get the facets, and that it is another quest...)

Regards!!

Jerome, it worked!!

David, Jerome, just let me know where to send the beers.

Regards!!