Running Lucene query using Elastic search API

Hi,
I am newbie to ES java API. I have a very small query, I have a lucene
query object parsed as:

    QueryParser qp = new QueryParser(Version.LUCENE_34, 

DEFAULT_SEARCHABLE_FIELD, new StandardAnalyzer(
Version.LUCENE_34));
Query q = qp.parse(luceneQuery);

How can i use it to perform search using Elastic search API. I did try to
extract out map out of it as:

        Map<String, String> termCollection = new HashMap<String, 

String>();
for(Term term : terms)
{
termCollection.put(term.field(), term.text());
// term.field();
// QueryBuilders.termQuery(term.field(), term.text());
// TermQuery query = new TermQuery(term);
// TermQueryBuilder
}
// QueryBuilders.tqueryString(q.)

    SearchResponse response = client.prepareSearch("es", 

"PersonHBase").setSearchType(SearchType.SCAN).setQuery(termCollection).execute().actionGet();

But i am getting :

"
org.elasticsearch.transport.TransportSerializationException: Failed to
deserialize exception response from stream
at
org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:171)
at
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:125)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:787)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:555)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:107)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:313)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Source)
at java.io.ObjectInputStream.skipCustomData(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at
org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:169)
... 23 more

"

--
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.

Have a look here: Elasticsearch Platform — Find real-time answers at scale | Elastic

It should help.

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

Le 21 févr. 2013 à 09:02, mishra.vivs@gmail.com a écrit :

Hi,
I am newbie to ES java API. I have a very small query, I have a lucene query object parsed as:

    QueryParser qp = new QueryParser(Version.LUCENE_34, DEFAULT_SEARCHABLE_FIELD, new StandardAnalyzer(
            Version.LUCENE_34));
        Query q = qp.parse(luceneQuery);

How can i use it to perform search using Elastic search API. I did try to extract out map out of it as:

        Map<String, String> termCollection = new HashMap<String, String>(); 
        for(Term term : terms)
        {
            termCollection.put(term.field(), term.text());

// term.field();
// QueryBuilders.termQuery(term.field(), term.text());
// TermQuery query = new TermQuery(term);
// TermQueryBuilder
}
// QueryBuilders.tqueryString(q.)

    SearchResponse response = client.prepareSearch("es", "PersonHBase").setSearchType(SearchType.SCAN).setQuery(termCollection).execute().actionGet();

But i am getting :

"
org.elasticsearch.transport.TransportSerializationException: Failed to deserialize exception response from stream
at org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:171)
at org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:125)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:787)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:555)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:107)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:313)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Source)
at java.io.ObjectInputStream.skipCustomData(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:169)
... 23 more

"

--
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.

This is what i have tried :
QueryParser qp = new QueryParser(Version.LUCENE_35,
DEFAULT_SEARCHABLE_FIELD, new StandardAnalyzer(
Version.LUCENE_34));
try
{
Query q = qp.parse(luceneQuery);
Set terms = new HashSet();
q.extractTerms(terms);

        QueryBuilder qq = null;
        Map<String, String> termCollection = new HashMap<String, 

String>();
for(Term term : terms)
{
// termCollection.put();
// qq =
QueryBuilders.boolQuery().must(QueryBuilders.termQuery(term.field(),
term.text()));
// qq = QueryBuilders.matchQuery(term.field(), term.text());
// break;
// term.field();
// QueryBuilders.termQuery(term.field(), term.text());
// TermQuery query = new TermQuery(term);
// TermQueryBuilder
}

// Query
SearchResponse response = client.prepareSearch("qq",
"PersonHBase").setSearchType(SearchType.QUERY_AND_FETCH).setQuery(qq).execute().actionGet();

but still same error. I am also not able to find anything in Elasticsearch
logs.

On Thursday, February 21, 2013 1:37:58 PM UTC+5:30, David Pilato wrote:

Have a look here:
Elasticsearch Platform — Find real-time answers at scale | Elastic

It should help.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 21 févr. 2013 à 09:02, mishr...@gmail.com <javascript:> a écrit :

Hi,
I am newbie to ES java API. I have a very small query, I have a lucene
query object parsed as:

    QueryParser qp = new QueryParser(Version.LUCENE_34, 

DEFAULT_SEARCHABLE_FIELD, new StandardAnalyzer(
Version.LUCENE_34));
Query q = qp.parse(luceneQuery);

How can i use it to perform search using Elastic search API. I did try to
extract out map out of it as:

        Map<String, String> termCollection = new HashMap<String, 

String>();
for(Term term : terms)
{
termCollection.put(term.field(), term.text());
// term.field();
// QueryBuilders.termQuery(term.field(), term.text());
// TermQuery query = new TermQuery(term);
// TermQueryBuilder
}
// QueryBuilders.tqueryString(q.)

    SearchResponse response = client.prepareSearch("es", 

"PersonHBase").setSearchType(SearchType.SCAN).setQuery(termCollection).execute().actionGet();

But i am getting :

"
org.elasticsearch.transport.TransportSerializationException: Failed to
deserialize exception response from stream
at
org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:171)
at
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:125)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:787)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:555)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:107)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:313)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Source)
at java.io.ObjectInputStream.skipCustomData(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at
org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:169)
... 23 more

"

--
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 elasticsearc...@googlegroups.com <javascript:>.
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.

Sorry read it as(Tried with bool query) :

    for(Term term : terms)
        {

// termCollection.put();
qq =
QueryBuilders.boolQuery().must(QueryBuilders.termQuery(term.field(),
term.text()));
// qq = QueryBuilders.matchQuery(term.field(), term.text());
// break;
// term.field();
// QueryBuilders.termQuery(term.field(), term.text());
// TermQuery query = new TermQuery(term);
// TermQueryBuilder
}

On Thursday, February 21, 2013 1:32:14 PM UTC+5:30, mishr...@gmail.com
wrote:

Hi,
I am newbie to ES java API. I have a very small query, I have a lucene
query object parsed as:

    QueryParser qp = new QueryParser(Version.LUCENE_34, 

DEFAULT_SEARCHABLE_FIELD, new StandardAnalyzer(
Version.LUCENE_34));
Query q = qp.parse(luceneQuery);

How can i use it to perform search using Elastic search API. I did try to
extract out map out of it as:

        Map<String, String> termCollection = new HashMap<String, 

String>();
for(Term term : terms)
{
termCollection.put(term.field(), term.text());
// term.field();
// QueryBuilders.termQuery(term.field(), term.text());
// TermQuery query = new TermQuery(term);
// TermQueryBuilder
}
// QueryBuilders.tqueryString(q.)

    SearchResponse response = client.prepareSearch("es", 

"PersonHBase").setSearchType(SearchType.SCAN).setQuery(termCollection).execute().actionGet();

But i am getting :

"
org.elasticsearch.transport.TransportSerializationException: Failed to
deserialize exception response from stream
at
org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:171)
at
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:125)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:787)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:555)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:107)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:313)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Source)
at java.io.ObjectInputStream.skipCustomData(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at
org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:169)
... 23 more

"

--
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.

What do you want to achieve?

Searching for different Terms in different fields?
Why are you trying to mix Lucene things with Elasticsearch API?

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

Le 21 févr. 2013 à 09:57, mishra.vivs@gmail.com a écrit :

This is what i have tried :
QueryParser qp = new QueryParser(Version.LUCENE_35, DEFAULT_SEARCHABLE_FIELD, new StandardAnalyzer(
Version.LUCENE_34));
try
{
Query q = qp.parse(luceneQuery);
Set terms = new HashSet();
q.extractTerms(terms);

        QueryBuilder qq = null;
        Map<String, String> termCollection = new HashMap<String, String>(); 
        for(Term term : terms)
        {

// termCollection.put();
// qq = QueryBuilders.boolQuery().must(QueryBuilders.termQuery(term.field(), term.text()));
// qq = QueryBuilders.matchQuery(term.field(), term.text());
// break;
// term.field();
// QueryBuilders.termQuery(term.field(), term.text());
// TermQuery query = new TermQuery(term);
// TermQueryBuilder
}

// Query
SearchResponse response = client.prepareSearch("qq", "PersonHBase").setSearchType(SearchType.QUERY_AND_FETCH).setQuery(qq).execute().actionGet();

but still same error. I am also not able to find anything in Elasticsearch logs.

On Thursday, February 21, 2013 1:37:58 PM UTC+5:30, David Pilato wrote:
Have a look here: Elasticsearch Platform — Find real-time answers at scale | Elastic

It should help.

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

Le 21 févr. 2013 à 09:02, mishr...@gmail.com a écrit :

Hi,
I am newbie to ES java API. I have a very small query, I have a lucene query object parsed as:

    QueryParser qp = new QueryParser(Version.LUCENE_34, DEFAULT_SEARCHABLE_FIELD, new StandardAnalyzer(
            Version.LUCENE_34));
        Query q = qp.parse(luceneQuery);

How can i use it to perform search using Elastic search API. I did try to extract out map out of it as:

        Map<String, String> termCollection = new HashMap<String, String>(); 
        for(Term term : terms)
        {
            termCollection.put(term.field(), term.text());

// term.field();
// QueryBuilders.termQuery(term.field(), term.text());
// TermQuery query = new TermQuery(term);
// TermQueryBuilder
}
// QueryBuilders.tqueryString(q.)

    SearchResponse response = client.prepareSearch("es", "PersonHBase").setSearchType(SearchType.SCAN).setQuery(termCollection).execute().actionGet();

But i am getting :

"
org.elasticsearch.transport.TransportSerializationException: Failed to deserialize exception response from stream
at org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:171)
at org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:125)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:787)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:555)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:107)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:313)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Source)
at java.io.ObjectInputStream.skipCustomData(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:169)
... 23 more

"

--
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 elasticsearc...@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 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.

As David already pointed out, you can use the Elasticsearch API, and
it's very easy, because "queryString" can parse Lucene syntax. You can
not mix Lucene Java API with Elasticsearch Java API.

Example:

String luceneQuery = "+Hello +World";
SearchResponse response =
client.prepareSearch("index").setQuery(QueryBuilders.queryString(luceneQuery).execute().actionGet();

Jörg

--
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.

I am using a third party library which is providing me Lucene format query.
It is certainly not possible to use it with ES java api in same format. So
i am trying to translate it using QueryBuilders API, which is again going
to parse it using QueryParserContext(parseInnerQuery). So conclusion is:

  1. I cannot use parse Lucene Query object.
  2. And translating it using QueryBuilders is giving me weird error. Also
    nothing is logged into ES_HOME/logs folder.

Isn't it possible to provide already parsed lucene query object for search
within Elasticsearch API(to avoid another parsing) ?

-Vivek

On Thu, Feb 21, 2013 at 2:41 PM, David Pilato david@pilato.fr wrote:

What do you want to achieve?

Searching for different Terms in different fields?
Why are you trying to mix Lucene things with Elasticsearch API?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 21 févr. 2013 à 09:57, mishra.vivs@gmail.com a écrit :

This is what i have tried :
QueryParser qp = new QueryParser(Version.LUCENE_35,
DEFAULT_SEARCHABLE_FIELD, new StandardAnalyzer(
Version.LUCENE_34));
try
{
Query q = qp.parse(luceneQuery);
Set terms = new HashSet();
q.extractTerms(terms);

        QueryBuilder qq = null;
        Map<String, String> termCollection = new HashMap<String,

String>();
for(Term term : terms)
{
// termCollection.put();
// qq =
QueryBuilders.boolQuery().must(QueryBuilders.termQuery(term.field(),
term.text()));
// qq = QueryBuilders.matchQuery(term.field(), term.text());
// break;
// term.field();
// QueryBuilders.termQuery(term.field(), term.text());
// TermQuery query = new TermQuery(term);
// TermQueryBuilder
}

// Query
SearchResponse response = client.prepareSearch("qq",
"PersonHBase").setSearchType(SearchType.QUERY_AND_FETCH).setQuery(qq).execute().actionGet();

but still same error. I am also not able to find anything in elastic
search logs.

On Thursday, February 21, 2013 1:37:58 PM UTC+5:30, David Pilato wrote:

Have a look here: http://www.Elasticsearch Platform — Find real-time answers at scale | Elastic
reference/java-api/query-dsl-**queries.htmlhttp://www.elasticsearch.org/guide/reference/java-api/query-dsl-queries.html

It should help.

--
David Pilato | Technical Advocate | Elasticsearch.comhttp://elasticsearch.com/
*
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
|
* @scrutmydocs https://twitter.com/scrutmydocs

Le 21 févr. 2013 à 09:02, mishr...@gmail.com a écrit :

Hi,
I am newbie to ES java API. I have a very small query, I have a lucene
query object parsed as:

    QueryParser qp = new QueryParser(Version.LUCENE_34,

DEFAULT_SEARCHABLE_FIELD, new StandardAnalyzer(
Version.LUCENE_34));
Query q = qp.parse(luceneQuery);

How can i use it to perform search using Elastic search API. I did try to
extract out map out of it as:

        Map<String, String> termCollection = new HashMap<String,

String>();
for(Term term : terms)
{
termCollection.put(term.field(**), term.text());
// term.field();
// QueryBuilders.termQuery(term.field(), term.text());
// TermQuery query = new TermQuery(term);
// TermQueryBuilder
}
// QueryBuilders.tqueryString(q.
)

    SearchResponse response = client.prepareSearch("es",

"PersonHBase").setSearchType(SearchType.SCAN).setQuery(
termCollection).execute().**actionGet();

But i am getting :

"
org.elasticsearch.transport.TransportSerializationException: Failed
to deserialize exception response from stream
at org.elasticsearch.transport.netty.MessageChannelHandler.
handlerResponseError(**MessageChannelHandler.java:**171)
at org.elasticsearch.transport.netty.MessageChannelHandler.
messageReceived(**MessageChannelHandler.java:**125)
at org.elasticsearch.common.netty.channel.
SimpleChannelUpstreamHandler.handleUpstream(
SimpleChannelUpstreamHandler.**java:70)
at org.elasticsearch.common.**netty.channel.DefaultChannelPipeline.
sendUpstream(**DefaultChannelPipeline.java:**560)
at org.elasticsearch.common.**netty.channel.DefaultChannelPipeline$
DefaultChannelHandlerContext.sendUpstream(
DefaultChannelPipeline.java:**787)
at org.elasticsearch.common.netty.channel.Channels.
fireMessageReceived(Channels.**java:296)
at org.elasticsearch.common.**netty.handler.codec.frame.FrameDecoder.
unfoldAndFireMessageReceived(**FrameDecoder.java:462)
at org.elasticsearch.common.netty.handler.codec.frame.
FrameDecoder.callDecode(**FrameDecoder.java:443)
at org.elasticsearch.common.netty.handler.codec.frame.
FrameDecoder.messageReceived(**FrameDecoder.java:303)
at org.elasticsearch.common.netty.channel.
SimpleChannelUpstreamHandler.handleUpstream(
SimpleChannelUpstreamHandler.**java:70)
at org.elasticsearch.common.**netty.channel.DefaultChannelPipeline.
sendUpstream(**DefaultChannelPipeline.java:**560)
at org.elasticsearch.common.**netty.channel.DefaultChannelPipeline.
sendUpstream(**DefaultChannelPipeline.java:**555)
at org.elasticsearch.common.netty.channel.Channels.
fireMessageReceived(Channels.**java:268)
at org.elasticsearch.common.netty.channel.Channels.
fireMessageReceived(Channels.**java:255)
at org.elasticsearch.common.netty.channel.socket.nio.
NioWorker.read(NioWorker.java:**88)
at org.elasticsearch.common.netty.channel.socket.nio.
AbstractNioWorker.process(**AbstractNioWorker.java:107)
at org.elasticsearch.common.netty.channel.socket.nio.
AbstractNioSelector.run(**AbstractNioSelector.java:313)
at org.elasticsearch.common.netty.channel.socket.nio.
AbstractNioWorker.run(**AbstractNioWorker.java:88)
at org.elasticsearch.common.netty.channel.socket.nio.
NioWorker.run(NioWorker.java:**178)
at org.elasticsearch.common.**netty.util.ThreadRenamingRunnable.run(
ThreadRenamingRunnable.java:**108)
at org.elasticsearch.common.netty.util.internal.
DeadLockProofWorker$1.run(**DeadLockProofWorker.java:42)
at java.util.concurrent.**ThreadPoolExecutor.runWorker(**Unknown Source)
at java.util.concurrent.**ThreadPoolExecutor$Worker.run(**Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$**BlockDataInputStream.peekByte(**Unknown
Source)
at java.io.ObjectInputStream.**skipCustomData(Unknown Source)
at java.io.ObjectInputStream.**readSerialData(Unknown Source)
at java.io.ObjectInputStream.**readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.**readObject0(Unknown Source)
at java.io.ObjectInputStream.**defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.**readSerialData(Unknown Source)
at java.io.ObjectInputStream.**readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.**readObject0(Unknown Source)
at java.io.ObjectInputStream.**defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.**readSerialData(Unknown Source)
at java.io.ObjectInputStream.**readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.**readObject0(Unknown Source)
at java.io.ObjectInputStream.**readObject(Unknown Source)
at org.elasticsearch.transport.netty.MessageChannelHandler.
handlerResponseError(**MessageChannelHandler.java:**169)
... 23 more

"

--
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 elasticsearc...@**googlegroups.com.

For more options, visit https://groups.google.com/**groups/opt_outhttps://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 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't directly execute parsed Lucene Query objects in ES for many
reasons. They would have to be executed on a single node on shard level,
so you can't search a whole index on a cluster, and they do not care
about the ES analyzers and type field mappings.

Jörg

Am 21.02.13 10:19, schrieb Vivek Mishra:

Isn't it possible to provide already parsed lucene query object for
search within Elasticsearch API(to avoid another parsing) ?

--
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 David and Jörg, able to run it now.

-Vivek

On Thu, Feb 21, 2013 at 2:49 PM, Vivek Mishra mishra.vivs@gmail.com wrote:

I am using a third party library which is providing me Lucene format
query. It is certainly not possible to use it with ES java api in same
format. So i am trying to translate it using QueryBuilders API, which is
again going to parse it using QueryParserContext(parseInnerQuery). So
conclusion is:

  1. I cannot use parse Lucene Query object.
  2. And translating it using QueryBuilders is giving me weird error. Also
    nothing is logged into ES_HOME/logs folder.

Isn't it possible to provide already parsed lucene query object for search
within Elasticsearch API(to avoid another parsing) ?

-Vivek

On Thu, Feb 21, 2013 at 2:41 PM, David Pilato david@pilato.fr wrote:

What do you want to achieve?

Searching for different Terms in different fields?
Why are you trying to mix Lucene things with Elasticsearch API?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 21 févr. 2013 à 09:57, mishra.vivs@gmail.com a écrit :

This is what i have tried :
QueryParser qp = new QueryParser(Version.LUCENE_35,
DEFAULT_SEARCHABLE_FIELD, new StandardAnalyzer(
Version.LUCENE_34));
try
{
Query q = qp.parse(luceneQuery);
Set terms = new HashSet();
q.extractTerms(terms);

        QueryBuilder qq = null;
        Map<String, String> termCollection = new HashMap<String,

String>();
for(Term term : terms)
{
// termCollection.put();
// qq =
QueryBuilders.boolQuery().must(QueryBuilders.termQuery(term.field(),
term.text()));
// qq = QueryBuilders.matchQuery(term.field(),
term.text());
// break;
// term.field();
// QueryBuilders.termQuery(term.field(), term.text());
// TermQuery query = new TermQuery(term);
// TermQueryBuilder
}

// Query
SearchResponse response = client.prepareSearch("qq",
"PersonHBase").setSearchType(SearchType.QUERY_AND_FETCH).setQuery(qq).execute().actionGet();

but still same error. I am also not able to find anything in elastic
search logs.

On Thursday, February 21, 2013 1:37:58 PM UTC+5:30, David Pilato wrote:

Have a look here: http://www.Elasticsearch Platform — Find real-time answers at scale | Elastic
reference/java-api/query-dsl-**queries.htmlhttp://www.elasticsearch.org/guide/reference/java-api/query-dsl-queries.html

It should help.

--
David Pilato | Technical Advocate | Elasticsearch.comhttp://elasticsearch.com/
*
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
|
* @scrutmydocs https://twitter.com/scrutmydocs

Le 21 févr. 2013 à 09:02, mishr...@gmail.com a écrit :

Hi,
I am newbie to ES java API. I have a very small query, I have a lucene
query object parsed as:

    QueryParser qp = new QueryParser(Version.LUCENE_34,

DEFAULT_SEARCHABLE_FIELD, new StandardAnalyzer(
Version.LUCENE_34));
Query q = qp.parse(luceneQuery);

How can i use it to perform search using Elastic search API. I did try
to extract out map out of it as:

        Map<String, String> termCollection = new HashMap<String,

String>();
for(Term term : terms)
{
termCollection.put(term.field(**), term.text());
// term.field();
// QueryBuilders.termQuery(term.field(), term.text());
// TermQuery query = new TermQuery(term);
// TermQueryBuilder
}
// QueryBuilders.tqueryString(q.
)

    SearchResponse response = client.prepareSearch("es",

"PersonHBase").setSearchType(SearchType.SCAN).setQuery(
termCollection).execute().**actionGet();

But i am getting :

"
org.elasticsearch.transport.TransportSerializationException: Failed
to deserialize exception response from stream
at org.elasticsearch.transport.netty.MessageChannelHandler.
handlerResponseError(**MessageChannelHandler.java:**171)
at org.elasticsearch.transport.netty.MessageChannelHandler.
messageReceived(**MessageChannelHandler.java:**125)
at org.elasticsearch.common.netty.channel.
SimpleChannelUpstreamHandler.handleUpstream(
SimpleChannelUpstreamHandler.**java:70)
at org.elasticsearch.common.**netty.channel.DefaultChannelPipeline.
sendUpstream(**DefaultChannelPipeline.java:**560)
at org.elasticsearch.common.**netty.channel.DefaultChannelPipeline$
DefaultChannelHandlerContext.sendUpstream(
DefaultChannelPipeline.java:**787)
at org.elasticsearch.common.netty.channel.Channels.
fireMessageReceived(Channels.**java:296)
at org.elasticsearch.common.**netty.handler.codec.frame.*FrameDecoder.
*unfoldAndFireMessageReceived(**FrameDecoder.java:462)
at org.elasticsearch.common.netty.handler.codec.frame.
FrameDecoder.callDecode(**FrameDecoder.java:443)
at org.elasticsearch.common.netty.handler.codec.frame.
FrameDecoder.messageReceived(**FrameDecoder.java:303)
at org.elasticsearch.common.netty.channel.
SimpleChannelUpstreamHandler.handleUpstream(
SimpleChannelUpstreamHandler.**java:70)
at org.elasticsearch.common.**netty.channel.DefaultChannelPipeline.
sendUpstream(**DefaultChannelPipeline.java:**560)
at org.elasticsearch.common.**netty.channel.DefaultChannelPipeline.
sendUpstream(**DefaultChannelPipeline.java:**555)
at org.elasticsearch.common.netty.channel.Channels.
fireMessageReceived(Channels.**java:268)
at org.elasticsearch.common.netty.channel.Channels.
fireMessageReceived(Channels.**java:255)
at org.elasticsearch.common.netty.channel.socket.nio.
NioWorker.read(NioWorker.java:**88)
at org.elasticsearch.common.netty.channel.socket.nio.
AbstractNioWorker.process(**AbstractNioWorker.java:107)
at org.elasticsearch.common.netty.channel.socket.nio.
AbstractNioSelector.run(**AbstractNioSelector.java:313)
at org.elasticsearch.common.netty.channel.socket.nio.
AbstractNioWorker.run(**AbstractNioWorker.java:88)
at org.elasticsearch.common.netty.channel.socket.nio.
NioWorker.run(NioWorker.java:**178)
at org.elasticsearch.common.**netty.util.*ThreadRenamingRunnable.run(
*ThreadRenamingRunnable.java:**108)
at org.elasticsearch.common.netty.util.internal.
DeadLockProofWorker$1.run(**DeadLockProofWorker.java:42)
at java.util.concurrent.**ThreadPoolExecutor.runWorker(**Unknown
Source)
at java.util.concurrent.**ThreadPoolExecutor$Worker.run(**Unknown
Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$**BlockDataInputStream.peekByte(**Unknown
Source)
at java.io.ObjectInputStream.**skipCustomData(Unknown Source)
at java.io.ObjectInputStream.**readSerialData(Unknown Source)
at java.io.ObjectInputStream.**readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.**readObject0(Unknown Source)
at java.io.ObjectInputStream.**defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.**readSerialData(Unknown Source)
at java.io.ObjectInputStream.**readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.**readObject0(Unknown Source)
at java.io.ObjectInputStream.**defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.**readSerialData(Unknown Source)
at java.io.ObjectInputStream.**readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.**readObject0(Unknown Source)
at java.io.ObjectInputStream.**readObject(Unknown Source)
at org.elasticsearch.transport.netty.MessageChannelHandler.
handlerResponseError(**MessageChannelHandler.java:**169)
... 23 more

"

--
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 elasticsearc...@**googlegroups.com.

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

Hi,
I am able to run queries like:
+PersonHBase.PERSON_NAME:vivek AND
+entity.class:com.impetus.bda.entities.personhbase

But somehow,

+PersonHBase.PERSON_NAME:vivek AND +PersonHBase.AGE:{10 TO null} AND
+entity.class:com.impetus.bda.entities.personhbase

is giving me weird error:

###################################################################################################################
org.elasticsearch.transport.TransportSerializationException: Failed to
deserialize exception response from stream
at
org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:171)
at
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:125)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:787)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:555)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:107)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:313)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Source)
at java.io.ObjectInputStream.skipCustomData(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at
org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:169)
... 23 more
#########################################################################################################################

From logs..i can see that it is complaining for NFE as:

Caused by: java.lang.NumberFormatException: For input string: "null"
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Long.parseLong(Long.java:441)
at java.lang.Long.parseLong(Long.java:483)
at
org.elasticsearch.index.mapper.core.LongFieldMapper.rangeQuery(LongFieldMapper.java:176)
at
org.apache.lucene.queryParser.MapperQueryParser.getRangeQuerySingle(MapperQueryParser.java:342)
at
org.apache.lucene.queryParser.MapperQueryParser.getRangeQuery(MapperQueryParser.java:331)
at org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1557)
at org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:1319)
at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1275)
at
org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:1234)
at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:206)
at
org.elasticsearch.index.query.QueryStringQueryParser.parse(QueryStringQueryParser.java:212)
at
org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:1
####################################################################################################################

Somehow same query works fine with lucene parser.

Any suggestions?

-Vivek

On Thu, Feb 21, 2013 at 3:55 PM, Vivek Mishra mishra.vivs@gmail.com wrote:

Thanks David and Jörg, able to run it now.

-Vivek

On Thu, Feb 21, 2013 at 2:49 PM, Vivek Mishra mishra.vivs@gmail.comwrote:

I am using a third party library which is providing me Lucene format
query. It is certainly not possible to use it with ES java api in same
format. So i am trying to translate it using QueryBuilders API, which is
again going to parse it using QueryParserContext(parseInnerQuery). So
conclusion is:

  1. I cannot use parse Lucene Query object.
  2. And translating it using QueryBuilders is giving me weird error. Also
    nothing is logged into ES_HOME/logs folder.

Isn't it possible to provide already parsed lucene query object for
search within Elasticsearch API(to avoid another parsing) ?

-Vivek

On Thu, Feb 21, 2013 at 2:41 PM, David Pilato david@pilato.fr wrote:

What do you want to achieve?

Searching for different Terms in different fields?
Why are you trying to mix Lucene things with Elasticsearch API?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 21 févr. 2013 à 09:57, mishra.vivs@gmail.com a écrit :

This is what i have tried :
QueryParser qp = new QueryParser(Version.LUCENE_35,
DEFAULT_SEARCHABLE_FIELD, new StandardAnalyzer(
Version.LUCENE_34));
try
{
Query q = qp.parse(luceneQuery);
Set terms = new HashSet();
q.extractTerms(terms);

        QueryBuilder qq = null;
        Map<String, String> termCollection = new HashMap<String,

String>();
for(Term term : terms)
{
// termCollection.put();
// qq =
QueryBuilders.boolQuery().must(QueryBuilders.termQuery(term.field(),
term.text()));
// qq = QueryBuilders.matchQuery(term.field(),
term.text());
// break;
// term.field();
// QueryBuilders.termQuery(term.field(), term.text());
// TermQuery query = new TermQuery(term);
// TermQueryBuilder
}

// Query
SearchResponse response = client.prepareSearch("qq",
"PersonHBase").setSearchType(SearchType.QUERY_AND_FETCH).setQuery(qq).execute().actionGet();

but still same error. I am also not able to find anything in elastic
search logs.

On Thursday, February 21, 2013 1:37:58 PM UTC+5:30, David Pilato wrote:

Have a look here: http://www.Elasticsearch Platform — Find real-time answers at scale | Elastic
reference/java-api/query-dsl-**queries.htmlhttp://www.elasticsearch.org/guide/reference/java-api/query-dsl-queries.html

It should help.

--
David Pilato | Technical Advocate | Elasticsearch.comhttp://elasticsearch.com/
*
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
|
* @scrutmydocs https://twitter.com/scrutmydocs

Le 21 févr. 2013 à 09:02, mishr...@gmail.com a écrit :

Hi,
I am newbie to ES java API. I have a very small query, I have a lucene
query object parsed as:

    QueryParser qp = new QueryParser(Version.LUCENE_34,

DEFAULT_SEARCHABLE_FIELD, new StandardAnalyzer(
Version.LUCENE_34));
Query q = qp.parse(luceneQuery);

How can i use it to perform search using Elastic search API. I did try
to extract out map out of it as:

        Map<String, String> termCollection = new HashMap<String,

String>();
for(Term term : terms)
{
termCollection.put(term.field(**), term.text());
// term.field();
// QueryBuilders.termQuery(term.field(), term.text());
// TermQuery query = new TermQuery(term);
// TermQueryBuilder
}
// QueryBuilders.tqueryString(q.
)

    SearchResponse response = client.prepareSearch("es",

"PersonHBase").setSearchType(SearchType.SCAN).setQuery(
termCollection).execute().**actionGet();

But i am getting :

"
org.elasticsearch.transport.TransportSerializationException:
Failed to deserialize exception response from stream
at org.elasticsearch.transport.netty.MessageChannelHandler.
handlerResponseError(**MessageChannelHandler.java:**171)
at org.elasticsearch.transport.netty.MessageChannelHandler.
messageReceived(**MessageChannelHandler.java:**125)
at org.elasticsearch.common.netty.channel.
SimpleChannelUpstreamHandler.handleUpstream(
SimpleChannelUpstreamHandler.**java:70)
at org.elasticsearch.common.**netty.channel.DefaultChannelPipeline.
sendUpstream(**DefaultChannelPipeline.java:**560)
at org.elasticsearch.common.**netty.channel.*DefaultChannelPipeline$
*DefaultChannelHandlerContext.sendUpstream(
DefaultChannelPipeline.java:**787)
at org.elasticsearch.common.netty.channel.Channels.
fireMessageReceived(Channels.**java:296)
at org.elasticsearch.common.**netty.handler.codec.frame.**FrameDecoder.
**unfoldAndFireMessageReceived(**FrameDecoder.java:462)
at org.elasticsearch.common.netty.handler.codec.frame.
FrameDecoder.callDecode(**FrameDecoder.java:443)
at org.elasticsearch.common.netty.handler.codec.frame.
FrameDecoder.messageReceived(**FrameDecoder.java:303)
at org.elasticsearch.common.netty.channel.
SimpleChannelUpstreamHandler.handleUpstream(
SimpleChannelUpstreamHandler.**java:70)
at org.elasticsearch.common.**netty.channel.DefaultChannelPipeline.
sendUpstream(**DefaultChannelPipeline.java:**560)
at org.elasticsearch.common.**netty.channel.*DefaultChannelPipeline.
*sendUpstream(**DefaultChannelPipeline.java:**555)
at org.elasticsearch.common.netty.channel.Channels.
fireMessageReceived(Channels.**java:268)
at org.elasticsearch.common.netty.channel.Channels.
fireMessageReceived(Channels.**java:255)
at org.elasticsearch.common.netty.channel.socket.nio.
NioWorker.read(NioWorker.java:**88)
at org.elasticsearch.common.netty.channel.socket.nio.
AbstractNioWorker.process(**AbstractNioWorker.java:107)
at org.elasticsearch.common.netty.channel.socket.nio.
AbstractNioSelector.run(**AbstractNioSelector.java:313)
at org.elasticsearch.common.netty.channel.socket.nio.
AbstractNioWorker.run(**AbstractNioWorker.java:88)
at org.elasticsearch.common.netty.channel.socket.nio.
NioWorker.run(NioWorker.java:**178)
at org.elasticsearch.common.**netty.util.**ThreadRenamingRunnable.run(
**ThreadRenamingRunnable.java:**108)
at org.elasticsearch.common.netty.util.internal.
DeadLockProofWorker$1.run(**DeadLockProofWorker.java:42)
at java.util.concurrent.**ThreadPoolExecutor.runWorker(**Unknown
Source)
at java.util.concurrent.**ThreadPoolExecutor$Worker.run(**Unknown
Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$**BlockDataInputStream.peekByte(**Unknown
Source)
at java.io.ObjectInputStream.**skipCustomData(Unknown Source)
at java.io.ObjectInputStream.**readSerialData(Unknown Source)
at java.io.ObjectInputStream.**readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.**readObject0(Unknown Source)
at java.io.ObjectInputStream.**defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.**readSerialData(Unknown Source)
at java.io.ObjectInputStream.**readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.**readObject0(Unknown Source)
at java.io.ObjectInputStream.**defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.**readSerialData(Unknown Source)
at java.io.ObjectInputStream.**readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.**readObject0(Unknown Source)
at java.io.ObjectInputStream.**readObject(Unknown Source)
at org.elasticsearch.transport.netty.MessageChannelHandler.
handlerResponseError(**MessageChannelHandler.java:**169)
... 23 more

"

--
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 elasticsearc...@**googlegroups.com.

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

Your "AGE" field is automatically mapped to type long. You have some
options: disable automatic mapping, set "AGE" field type to string, or
fix the wrong range query term. For example, PersonHBase.AGE:[10 TO *]

Jörg

Am 21.02.13 11:47, schrieb Vivek Mishra:

PersonHBase.AGE:{10 TO null}

--
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.

Ok. One question. why is it mapped to long by default, Shouldn't by default
it should be string?

Thanks for suggestion, i guess can move ahead with this.

Cheers,
-Vivek

On Thu, Feb 21, 2013 at 4:25 PM, Jörg Prante joergprante@gmail.com wrote:

Your "AGE" field is automatically mapped to type long. You have some
options: disable automatic mapping, set "AGE" field type to string, or fix
the wrong range query term. For example, PersonHBase.AGE:[10 TO *]

Jörg

Am 21.02.13 11:47, schrieb Vivek Mishra:

PersonHBase.AGE:{10 TO null}

--
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.comelasticsearch%2Bunsubscribe@googlegroups.com
.
For more options, visit https://groups.google.com/**groups/opt_outhttps://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.

ES performs automatic field type detection. It checks for date type and
for numeric types before it assumes a string type. It's a long type
because the first value you have indexed for this field was an integer
number (which is processed as a Java long type).

I admit it is not clearly understandable from reading the docs in

It's also scattered over

and Elasticsearch Platform — Find real-time answers at scale | Elastic
and
Elasticsearch Platform — Find real-time answers at scale | Elastic

Jörg

Am 21.02.13 12:04, schrieb Vivek Mishra:

One question. why is it mapped to long by default, Shouldn't by
default it should be string?

--
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.