WARNING: Version 5.x has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Term Query Usage
editTerm Query Usage
editFluent DSL example
editq .Term(c => c .Name("named_query") .Boost(1.1) .Field(p => p.Description) .Value("project description") )
Object Initializer syntax example
editnew TermQuery { Name = "named_query", Boost = 1.1, Field = "description", Value = "project description" }
Example json output.
{ "term": { "description": { "_name": "named_query", "boost": 1.1, "value": "project description" } } }
Verbatim term query
editBy default an empty term is conditionless so will be rewritten. Sometimes sending an empty term to
match nothing makes sense. You can either use the ConditionlessQuery
construct from NEST to provide a fallback or make the
query verbatim as followed:
Fluent DSL example
editq .Term(c => c .Verbatim() .Field(p => p.Description) .Value(string.Empty) )
Object Initializer syntax example
editnew TermQuery { IsVerbatim = true, Field = "description", Value = "", }
Example json output.
{ "term": { "description": { "value": "" } } }