Match Usage

edit

Fluent DSL example

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

Object Initializer syntax example

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

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,
      "cutoff_frequency": 0.001,
      "lenient": true,
      "minimum_should_match": 2,
      "operator": "or"
    }
  }
}