Package org.elasticsearch.join.mapper
Class Joiner
java.lang.Object
org.elasticsearch.join.mapper.Joiner
public final class Joiner
extends java.lang.Object
Utility class to help build join queries and aggregations, based on a join_field
-
Method Summary
Modifier and Type Method Description java.lang.StringchildJoinField(java.lang.String parentType)org.apache.lucene.search.QuerychildrenFilter(java.lang.String parentType)booleanchildTypeExists(java.lang.String type)org.apache.lucene.search.Queryfilter(java.lang.String relationType)static JoinergetJoiner(org.elasticsearch.index.query.SearchExecutionContext context)Get the Joiner for this context, ornullif none is configuredstatic JoinergetJoiner(org.elasticsearch.search.aggregations.support.AggregationContext context)Get the Joiner for this context, ornullif none is configuredjava.lang.StringgetJoinField()booleanknownRelation(java.lang.String type)org.apache.lucene.search.QueryparentFilter(java.lang.String childType)java.lang.StringparentJoinField(java.lang.String childType)booleanparentTypeExists(java.lang.String type)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
getJoiner
Get the Joiner for this context, ornullif none is configured -
getJoiner
public static Joiner getJoiner(org.elasticsearch.search.aggregations.support.AggregationContext context)Get the Joiner for this context, ornullif none is configured -
getJoinField
public java.lang.String getJoinField()- Returns:
- the join field for the index
-
filter
public org.apache.lucene.search.Query filter(java.lang.String relationType)- Returns:
- a filter for documents of a specific join type
-
parentFilter
public org.apache.lucene.search.Query parentFilter(java.lang.String childType)- Returns:
- a filter for parent documents of a specific child type
-
childrenFilter
public org.apache.lucene.search.Query childrenFilter(java.lang.String parentType)- Returns:
- a filter for child documents of a specific parent type
-
childTypeExists
public boolean childTypeExists(java.lang.String type)- Returns:
trueif the child type has been defined for the join field
-
parentTypeExists
public boolean parentTypeExists(java.lang.String type)- Returns:
trueif the parent type has been defined for the join field
-
knownRelation
public boolean knownRelation(java.lang.String type)- Returns:
trueif the type has been defined as either a parent or a child for the join field
-
parentJoinField
public java.lang.String parentJoinField(java.lang.String childType)- Returns:
- the name of the linked join field for documents of a specific child type
-
childJoinField
public java.lang.String childJoinField(java.lang.String parentType)- Returns:
- the name of the linked join field for documents of a specific parent type
-