Skip to content

Commit

Permalink
parent/child: Deprecated the top_children in favour of the `has_chi…
Browse files Browse the repository at this point in the history
…ld` query.
  • Loading branch information
martijnvg committed May 6, 2015
1 parent ec4f12f commit 97a9faf
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 3 deletions.
7 changes: 7 additions & 0 deletions docs/reference/migration/migrate_1_6.asciidoc
Expand Up @@ -8,3 +8,10 @@ your application from Elasticsearch 1.x to Elasticsearch 1.6.
=== More Like This API

The More Like This API query has been deprecated and will be removed in 2.0. Instead use the <<query-dsl-mlt-query, More Like This Query>>.

[float]
=== `top_children` query

The `top_children` query has been deprecated and will be removed in 2.0. Instead the `has_child` query should be used.
The `top_children` query isn't always faster than the `has_child` query and the `top_children` query is often inaccurate.
The total hits and any aggregations in the same search request will likely be off.
2 changes: 2 additions & 0 deletions docs/reference/query-dsl/queries/top-children-query.asciidoc
@@ -1,6 +1,8 @@
[[query-dsl-top-children-query]]
=== Top Children Query

deprecated[1.6.0, Use the `has_child` query instead]

The `top_children` query runs the child query with an estimated hits
size, and out of the hit docs, aggregates it into parent docs. If there
aren't enough parent docs matching the requested from/size search
Expand Down
Expand Up @@ -475,6 +475,7 @@ public static MoreLikeThisQueryBuilder moreLikeThisQuery() {
* @param type The child type.
* @param query The query.
*/
@Deprecated
public static TopChildrenQueryBuilder topChildrenQuery(String type, QueryBuilder query) {
return new TopChildrenQueryBuilder(type, query);
}
Expand Down
Expand Up @@ -25,6 +25,7 @@
/**
*
*/
@Deprecated
public class TopChildrenQueryBuilder extends BaseQueryBuilder implements BoostableQueryBuilder<TopChildrenQueryBuilder> {

private final QueryBuilder queryBuilder;
Expand Down
Expand Up @@ -38,6 +38,7 @@
/**
*
*/
@Deprecated
public class TopChildrenQueryParser implements QueryParser {

public static final String NAME = "top_children";
Expand Down
Expand Up @@ -20,15 +20,13 @@

import com.carrotsearch.hppc.IntObjectOpenHashMap;
import com.carrotsearch.hppc.ObjectObjectOpenHashMap;

import org.apache.lucene.index.*;
import org.apache.lucene.search.*;
import org.apache.lucene.search.join.BitDocIdSetFilter;
import org.apache.lucene.util.*;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.common.lease.Releasable;
import org.elasticsearch.common.lucene.IndexCacheableQuery;
import org.elasticsearch.common.lucene.search.EmptyScorer;
import org.apache.lucene.search.join.BitDocIdSetFilter;
import org.elasticsearch.index.fielddata.IndexParentChildFieldData;
import org.elasticsearch.index.mapper.Uid;
import org.elasticsearch.index.mapper.internal.UidFieldMapper;
Expand All @@ -54,6 +52,7 @@
* This query is most of the times faster than the {@link ChildrenQuery}. Usually enough parent documents can be returned
* in the first child document query round.
*/
@Deprecated`
public class TopChildrenQuery extends IndexCacheableQuery {

private static final ParentDocComparator PARENT_DOC_COMP = new ParentDocComparator();
Expand Down

0 comments on commit 97a9faf

Please sign in to comment.