Method HasAncestor
HasAncestor<TField>(FieldDefinition<TDocument, IEnumerable<TField>>, SearchDefinition<TDocument>, SearchScoreDefinition<TDocument>)
Creates a search definition that moves the context back up the tree of embedded documents to one of the ancestors of the current embedded document such that ancestor fields can be used in searches of embedded documents.
public SearchDefinition<TDocument> HasAncestor<TField>(FieldDefinition<TDocument, IEnumerable<TField>> path, SearchDefinition<TDocument> @operator, SearchScoreDefinition<TDocument> score = null)
Parameters
pathFieldDefinition<TDocument, IEnumerable<TField>>The path from the root to the ancestor.
operatorSearchDefinition<TDocument>The operator to execute in the ancestor context specified by
path.scoreSearchScoreDefinition<TDocument>The score modifier.
Returns
- SearchDefinition<TDocument>
A search definition for the ancestor.
Type Parameters
TFieldThe type of the ancestor documents.
HasAncestor<TField>(Expression<Func<TDocument, IEnumerable<TField>>>, SearchDefinition<TDocument>, SearchScoreDefinition<TDocument>)
Creates a search definition that moves the context back up the tree of embedded documents to one of the ancestors of the current embedded document such that ancestor fields can be used in searches of embedded documents.
public SearchDefinition<TDocument> HasAncestor<TField>(Expression<Func<TDocument, IEnumerable<TField>>> path, SearchDefinition<TDocument> @operator, SearchScoreDefinition<TDocument> score = null)
Parameters
pathExpression<Func<TDocument, IEnumerable<TField>>>The path from the root to the ancestor.
operatorSearchDefinition<TDocument>The operator to execute in the ancestor context specified by
path.scoreSearchScoreDefinition<TDocument>The score modifier.
Returns
- SearchDefinition<TDocument>
A search definition for the ancestor.
Type Parameters
TFieldThe type of the ancestor documents.