Simple Query String Usageedit

Fluent DSL exampleedit

q
.SimpleQueryString(c => c
    .Name("named_query")
    .Boost(1.1)
    .Fields(f => f.Field(p => p.Description).Field("myOtherField"))
    .Query("hello world")
    .Analyzer("standard")
    .DefaultOperator(Operator.Or)
    .Flags(SimpleQueryStringFlags.And | SimpleQueryStringFlags.Near)
    .Locale("en_US")
    .LowercaseExpendedTerms()
    .Lenient()
    .AnalyzeWildcard()
    .MinimumShouldMatch("30%")
)

Object Initializer syntax exampleedit

new SimpleQueryStringQuery
{
    Name = "named_query",
    Boost = 1.1,
    Fields = Field<Project>(p => p.Description).And("myOtherField"),
    Query = "hello world",
    Analyzer = "standard",
    DefaultOperator = Operator.Or,
    Flags = SimpleQueryStringFlags.And | SimpleQueryStringFlags.Near,
    Locale = "en_US",
    LowercaseExpendedTerms = true,
    Lenient = true,
    AnalyzeWildcard = true,
    MinimumShouldMatch = "30%"
}

Example json output.

{
  "simple_query_string": {
    "_name": "named_query",
    "boost": 1.1,
    "fields": [
      "description",
      "myOtherField"
    ],
    "query": "hello world",
    "analyzer": "standard",
    "default_operator": "or",
    "flags": "AND|NEAR",
    "locale": "en_US",
    "lowercase_expanded_terms": true,
    "lenient": true,
    "analyze_wildcard": true,
    "minimum_should_match": "30%"
  }
}