Match Usage

edit

Fluent DSL example

edit
q
.Match(c => c
    .Field(p => p.Description)
    .Analyzer("standard")
    .Boost(1.1)
    .Query("hello world")
    .Fuzziness(Fuzziness.AutoLength(3, 6))
    .Lenient()
    .FuzzyTranspositions()
    .MinimumShouldMatch(2)
    .Operator(Operator.Or)
    .FuzzyRewrite(MultiTermQueryRewrite.TopTermsBlendedFreqs(10))
    .Name("named_query")
    .AutoGenerateSynonymsPhraseQuery(false)
)

Object Initializer syntax example

edit
new MatchQuery
{
    Field = Field<Project>(p => p.Description),
    Analyzer = "standard",
    Boost = 1.1,
    Name = "named_query",
    Query = "hello world",
    Fuzziness = Fuzziness.AutoLength(3, 6),
    FuzzyTranspositions = true,
    MinimumShouldMatch = 2,
    FuzzyRewrite = MultiTermQueryRewrite.TopTermsBlendedFreqs(10),
    Lenient = true,
    Operator = Operator.Or,
    AutoGenerateSynonymsPhraseQuery = false
}

Example json output.

{
  "match": {
    "description": {
      "_name": "named_query",
      "boost": 1.1,
      "query": "hello world",
      "analyzer": "standard",
      "fuzzy_rewrite": "top_terms_blended_freqs_10",
      "fuzziness": "AUTO:3,6",
      "fuzzy_transpositions": true,
      "lenient": true,
      "minimum_should_match": 2,
      "operator": "or",
      "auto_generate_synonyms_phrase_query": false
    }
  }
}