NOTE: You are looking at documentation for an older release. For the latest information, see the current release documentation.
Terms List Query Usage
editTerms List Query Usage
editFluent DSL example
editq .Terms(c => c .Name("named_query") .Boost(1.1) .Field(p => p.Description) .Terms(new List<string> { "term1", "term2" }) )
Object Initializer syntax example
editnew TermsQuery { Name = "named_query", Boost = 1.1, Field = "description", Terms = new List<string> { "term1", "term2" } }
Example json output.
{ "terms": { "_name": "named_query", "boost": 1.1, "description": [ "term1", "term2" ] } }
Fluent DSL example
editq .Terms(c => c .Name("named_query") .Boost(1.1) .Field(p => p.Description) .Terms(_terms) )
Object Initializer syntax example
editnew TermsQuery { Name = "named_query", Boost = 1.1, Field = "description", Terms = _terms }
Example json output.
{ "terms": { "_name": "named_query", "boost": 1.1, "description": [ [ "term1", "term2" ] ] } }
Handling Responses
editresponse.ShouldNotBeValid(); response.ServerError.Should().NotBeNull(); response.ServerError.Status.Should().Be(400); response.ServerError.Error.Should().NotBeNull(); var rootCauses = response.ServerError.Error.RootCause; rootCauses.Should().NotBeNullOrEmpty(); var rootCause = rootCauses.First(); rootCause.Type.Should().Be("parsing_exception");
Fluent DSL example
editq .Terms(c => c .Name("named_query") .Boost(1.1) .Field(p => p.NumberOfCommits) .Terms(_terms) )
Object Initializer syntax example
editnew TermsQuery { Name = "named_query", Boost = 1.1, Field = "numberOfCommits", Terms = _terms, }
Example json output.
{ "terms": { "_name": "named_query", "boost": 1.1, "numberOfCommits": [ [ "term1", "term2" ] ] } }
Handling Responses
editresponse.ServerError.Should().NotBeNull(); response.ServerError.Status.Should().Be(400); response.ServerError.Error.Should().NotBeNull(); var rootCauses = response.ServerError.Error.RootCause; rootCauses.Should().NotBeNullOrEmpty(); var rootCause = rootCauses.First(); rootCause.Type.Should().Be("parsing_exception");