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?
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?
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?
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?
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.
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?
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?
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?
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:
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?
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?
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...)
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.