Possible Bug in Java API 0.19.0.RC2? Query works in elasticsearch-head, fails in java app


(George L) #1

Hello,

The below query was built using java api and when tried in the app,
it comes back with zero hits and facets.
But the same query when cut/paste into the elasticsearch-head tool, it
comes back with proper hits and facets.

I just need to know whether its a valid query or which one is correct,
java api or json post.

Thanks
George

Below is the query

{
"from" : 0,
"size" : 2,
"query" : {
"filtered" : {
"query" : {
"match_all" : {
}
},
"filter" : {
"bool" : {
"must" : {
"term" : {
"paths" : "/1"
}
}
}
}
}
},
"facets" : {
"paths" : {
"terms" : {
"field" : "paths",
"size" : 100,
"regex" : "/1/[^/]+"
}
}
}
}


(Shay Banon) #2

It looks good. Can you repro the failed Java code in a standalone test?

On Friday, February 17, 2012 at 7:41 PM, George L wrote:

Hello,

The below query was built using java api and when tried in the app,
it comes back with zero hits and facets.
But the same query when cut/paste into the elasticsearch-head tool, it
comes back with proper hits and facets.

I just need to know whether its a valid query or which one is correct,
java api or json post.

Thanks
George

Below is the query

{
"from" : 0,
"size" : 2,
"query" : {
"filtered" : {
"query" : {
"match_all" : {
}
},
"filter" : {
"bool" : {
"must" : {
"term" : {
"paths" : "/1"
}
}
}
}
}
},
"facets" : {
"paths" : {
"terms" : {
"field" : "paths",
"size" : 100,
"regex" : "/1/[^/]+"
}
}
}
}


(George L) #3

Not a Bug, Probably a suggestion.

It was a development mistake, set a wrong document type in the
SearchRequestBuilder.

The toString() of SearchRequestBuilder doesn't print the document type
or index.

This took time to figure out the problem.

Thanks
George

On Feb 17, 11:48 am, Shay Banon kim...@gmail.com wrote:

It looks good. Can you repro the failed Java code in a standalone test?

On Friday, February 17, 2012 at 7:41 PM, George L wrote:

Hello,

The below query was built using java api and when tried in the app,
it comes back with zero hits and facets.
But the same query when cut/paste into the elasticsearch-head tool, it
comes back with proper hits and facets.

I just need to know whether its a valid query or which one is correct,
java api or json post.

Thanks
George

Below is the query

{
"from" : 0,
"size" : 2,
"query" : {
"filtered" : {
"query" : {
"match_all" : {
}
},
"filter" : {
"bool" : {
"must" : {
"term" : {
"paths" : "/1"
}
}
}
}
}
},
"facets" : {
"paths" : {
"terms" : {
"field" : "paths",
"size" : 100,
"regex" : "/1/[^/]+"
}
}
}
}


(Shay Banon) #4

Ahh, yea, it just prints out the "body" of the request. Open an issue? Can be added easily.

On Friday, February 17, 2012 at 11:14 PM, George L wrote:

Not a Bug, Probably a suggestion.

It was a development mistake, set a wrong document type in the
SearchRequestBuilder.

The toString() of SearchRequestBuilder doesn't print the document type
or index.

This took time to figure out the problem.

Thanks
George

On Feb 17, 11:48 am, Shay Banon <kim...@gmail.com (http://gmail.com)> wrote:

It looks good. Can you repro the failed Java code in a standalone test?

On Friday, February 17, 2012 at 7:41 PM, George L wrote:

Hello,

The below query was built using java api and when tried in the app,
it comes back with zero hits and facets.
But the same query when cut/paste into the elasticsearch-head tool, it
comes back with proper hits and facets.

I just need to know whether its a valid query or which one is correct,
java api or json post.

Thanks
George

Below is the query

{
"from" : 0,
"size" : 2,
"query" : {
"filtered" : {
"query" : {
"match_all" : {
}
},
"filter" : {
"bool" : {
"must" : {
"term" : {
"paths" : "/1"
}
}
}
}
}
},
"facets" : {
"paths" : {
"terms" : {
"field" : "paths",
"size" : 100,
"regex" : "/1/[^/]+"
}
}
}
}


(system) #5