parent
0808c98eeb
commit
f5e351aaf1
|
@ -397,6 +397,10 @@ public class ParentChildIndexFieldData extends AbstractIndexFieldData<AtomicPare
|
||||||
@Override
|
@Override
|
||||||
public SortedDocValues getOrdinalsValues(String type) {
|
public SortedDocValues getOrdinalsValues(String type) {
|
||||||
final OrdinalMapAndAtomicFieldData atomicFD = this.atomicFD.get(type);
|
final OrdinalMapAndAtomicFieldData atomicFD = this.atomicFD.get(type);
|
||||||
|
if (atomicFD == null) {
|
||||||
|
return DocValues.emptySorted();
|
||||||
|
}
|
||||||
|
|
||||||
final OrdinalMap ordMap = atomicFD.ordMap;
|
final OrdinalMap ordMap = atomicFD.ordMap;
|
||||||
final SortedDocValues[] allSegmentValues = new SortedDocValues[atomicFD.fieldData.length];
|
final SortedDocValues[] allSegmentValues = new SortedDocValues[atomicFD.fieldData.length];
|
||||||
for (int i = 0; i < allSegmentValues.length; ++i) {
|
for (int i = 0; i < allSegmentValues.length; ++i) {
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.search.child;
|
package org.elasticsearch.search.child;
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
|
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
|
||||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
|
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
|
||||||
import org.elasticsearch.action.count.CountResponse;
|
import org.elasticsearch.action.count.CountResponse;
|
||||||
|
@ -2013,7 +2012,6 @@ public class ChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elasticsearch/elasticsearch/issues/9461")
|
|
||||||
public void testParentFieldToNonExistingType() {
|
public void testParentFieldToNonExistingType() {
|
||||||
assertAcked(prepareCreate("test").addMapping("parent").addMapping("child", "_parent", "type=parent2"));
|
assertAcked(prepareCreate("test").addMapping("parent").addMapping("child", "_parent", "type=parent2"));
|
||||||
client().prepareIndex("test", "parent", "1").setSource("{}").get();
|
client().prepareIndex("test", "parent", "1").setSource("{}").get();
|
||||||
|
@ -2032,19 +2030,6 @@ public class ChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
||||||
.setQuery(QueryBuilders.hasParentQuery("parent", matchAllQuery()))
|
.setQuery(QueryBuilders.hasParentQuery("parent", matchAllQuery()))
|
||||||
.get();
|
.get();
|
||||||
assertHitCount(response, 0);
|
assertHitCount(response, 0);
|
||||||
|
|
||||||
try {
|
|
||||||
client().prepareSearch("test")
|
|
||||||
.setQuery(QueryBuilders.constantScoreQuery(QueryBuilders.hasChildQuery("child", matchAllQuery())))
|
|
||||||
.get();
|
|
||||||
fail();
|
|
||||||
} catch (SearchPhaseExecutionException e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
response = client().prepareSearch("test")
|
|
||||||
.setQuery(QueryBuilders.constantScoreQuery(QueryBuilders.hasParentQuery("parent", matchAllQuery())))
|
|
||||||
.get();
|
|
||||||
assertHitCount(response, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HasChildQueryBuilder hasChildQuery(String type, QueryBuilder queryBuilder) {
|
static HasChildQueryBuilder hasChildQuery(String type, QueryBuilder queryBuilder) {
|
||||||
|
|
Loading…
Reference in New Issue