Match Phrase Prefix Usage

edit

Fluent DSL example

edit
q
.MatchPhrasePrefix(c => c
    .Field(p => p.Description)
    .Analyzer("standard")
    .Boost(1.1)
    .CutoffFrequency(0.001)
    .Query("hello worl")
    .Fuzziness(Fuzziness.Auto)
    .Lenient()
    .FuzzyTranspositions()
    .MaxExpansions(2)
    .MinimumShouldMatch(2)
    .PrefixLength(2)
    .Operator(Operator.Or)
    .FuzzyRewrite(MultiTermQueryRewrite.ConstantScoreBoolean)
    .Slop(2)
    .Name("named_query")
)

Object Initializer syntax example

edit
new MatchPhrasePrefixQuery
{
    Field = Field<Project>(p => p.Description),
    Analyzer = "standard",
    Boost = 1.1,
    Name = "named_query",
    CutoffFrequency = 0.001,
    Query = "hello worl",
    Fuzziness = Fuzziness.Auto,
    FuzzyTranspositions = true,
    MinimumShouldMatch = 2,
    FuzzyMultiTermQueryRewrite = MultiTermQueryRewrite.ConstantScoreBoolean,
    MaxExpansions = 2,
    Slop = 2,
    Lenient = true,
    Operator = Operator.Or,
    PrefixLength = 2
}

Example json output.

{
  "match": {
    "description": {
      "_name": "named_query",
      "boost": 1.1,
      "query": "hello worl",
      "analyzer": "standard",
      "fuzzy_rewrite": "constant_score_boolean",
      "fuzziness": "AUTO",
      "fuzzy_transpositions": true,
      "cutoff_frequency": 0.001,
      "prefix_length": 2,
      "max_expansions": 2,
      "slop": 2,
      "lenient": true,
      "minimum_should_match": 2,
      "operator": "or",
      "type": "phrase_prefix"
    }
  }
}