Problem with SearchRequestBuilder.setSize

For some reason, when I'm using the Java API, the setSize method on
SearchRequestBuilder appears to be ignored completely. After building my
request, I print it out and get this:

Query: #<SearchRequestBuilder {
"size" : 1,
"query" : {
"match" : {
"name" : {
"query" : "testing",
"type" : "phrase",
"analyzer" : "english"
}
}
},
"explain" : false
}>

When I execute that request builder, I don't get one result back, I get all
three (my sample data set only has three entries). But if I copy that JSON
and submit it directly to the ElasticSearch server (embedded in my app), I
get one result back.

Is setSize not what I should be calling to limit the number of results?

--

Sorry, I figured it out from an older post I found after posting this. I
was using DFS_QUERY_AND_FETCH, and I should have been using
DFS_QUERY_THEN_FETCH.

On Wednesday, January 9, 2013 2:12:00 PM UTC-7, Sean Bowman wrote:

For some reason, when I'm using the Java API, the setSize method on
SearchRequestBuilder appears to be ignored completely. After building my
request, I print it out and get this:

Query: #<SearchRequestBuilder {
"size" : 1,
"query" : {
"match" : {
"name" : {
"query" : "testing",
"type" : "phrase",
"analyzer" : "english"
}
}
},
"explain" : false
}>

When I execute that request builder, I don't get one result back, I get
all three (my sample data set only has three entries). But if I copy that
JSON and submit it directly to the ElasticSearch server (embedded in my
app), I get one result back.

Is setSize not what I should be calling to limit the number of results?

--