IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Terms Query Usage
editTerms Query Usage
editFilters documents that have fields that match any of the provided terms (not analyzed).
Be sure to read the Elasticsearch documentation on Terms query for more information.
Fluent DSL example
editq .Terms(c => c .Name("named_query") .Boost(1.1) .Field(p => p.Description) .Terms("term1", "term2") )
Object Initializer syntax example
editnew TermsQuery { Name = "named_query", Boost = 1.1, Field = "description", Terms = ExpectedTerms, }
Example json output.
{ "terms": { "_name": "named_query", "boost": 1.1, "description": [ "term1", "term2" ] } }
Single term Terms Query
editFluent DSL example
editq .Terms(c => c .Name("named_query") .Boost(1.1) .Field(p => p.Description) .Terms("term1") )
Verbatim terms query
editBy default an empty terms array is conditionless so will be rewritten. Sometimes sending an empty array to mean
match nothing makes sense. You can either use the ConditionlessQuery
construct from NEST to provide a fallback or make the
query verbatim as followed:
Object Initializer syntax example
editnew TermsQuery { IsVerbatim = true, Field = "description", Terms = new string[] { }, }
Example json output.
{ "terms": { "description": [] } }
Fluent DSL example
editq .Terms(c => c .Verbatim() .Field(p => p.Description) .Terms(new string[] { }) )