Fuzzy Date Query Usage

edit

Fluent DSL example

edit
q
.FuzzyDate(c => c
    .Name("named_query")
    .Boost(1.1)
    .Field(p => p.Description)
    .Fuzziness(TimeSpan.FromDays(2))
    .Value(Project.Instance.StartedOn)
    .MaxExpansions(100)
    .PrefixLength(3)
    .Rewrite(MultiTermQueryRewrite.ConstantScore)
    .Transpositions()
)

Object Initializer syntax example

edit
new FuzzyDateQuery
{
    Name = "named_query",
    Boost = 1.1,
    Field = "description",
    Fuzziness = TimeSpan.FromDays(2),
    Value = Project.Instance.StartedOn,
    MaxExpansions = 100,
    PrefixLength = 3,
    Rewrite = MultiTermQueryRewrite.ConstantScore,
    Transpositions = true
}

Example json output.

{
  "fuzzy": {
    "description": {
      "_name": "named_query",
      "boost": 1.1,
      "fuzziness": "2d",
      "max_expansions": 100,
      "prefix_length": 3,
      "rewrite": "constant_score",
      "transpositions": true,
      "value": "2015-01-01T00:00:00"
    }
  }
}