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)
    .Lenient()
    .AnalyzeWildcard()
    .MinimumShouldMatch("30%")
    .FuzzyPrefixLength(0)
    .FuzzyMaxExpansions(50)
    .FuzzyTranspositions()
    .AutoGenerateSynonymsPhraseQuery(false)
)

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,
    Lenient = true,
    AnalyzeWildcard = true,
    MinimumShouldMatch = "30%",
    FuzzyPrefixLength = 0,
    FuzzyMaxExpansions = 50,
    FuzzyTranspositions = true,
    AutoGenerateSynonymsPhraseQuery = false
}

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",
    "lenient": true,
    "analyze_wildcard": true,
    "minimum_should_match": "30%",
    "fuzzy_prefix_length": 0,
    "fuzzy_max_expansions": 50,
    "fuzzy_transpositions": true,
    "auto_generate_synonyms_phrase_query": false
  }
}