doc nested docs and get / uid

This commit is contained in:
Shay Banon 2012-01-11 15:01:40 +02:00
parent 9d979dfc01
commit 771dbdb4bc
2 changed files with 4 additions and 0 deletions

View File

@ -48,6 +48,8 @@ public class UidField extends AbstractField {
}
}
// this works fine for nested docs since they don't have the payload which has the version
// so we iterate till we find the one with the payload
public static DocIdAndVersion loadDocIdAndVersion(IndexReader reader, Term term) {
int docId = Lucene.NO_DOC;
TermPositions uid = null;

View File

@ -41,6 +41,7 @@ import static org.elasticsearch.index.query.FilterBuilders.nestedFilter;
import static org.elasticsearch.index.query.QueryBuilders.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;
@Test
public class SimpleNestedTests extends AbstractNodesTests {
@ -99,6 +100,7 @@ public class SimpleNestedTests extends AbstractNodesTests {
client.admin().indices().prepareFlush().setRefresh(true).execute().actionGet();
GetResponse getResponse = client.prepareGet("test", "type1", "1").execute().actionGet();
assertThat(getResponse.exists(), equalTo(true));
assertThat(getResponse.source(), notNullValue());
// check the numDocs
IndicesStatusResponse statusResponse = client.admin().indices().prepareStatus().execute().actionGet();