Common Terms Usage

edit

Fluent DSL example

edit
q
.CommonTerms(c => c
    .Field(p => p.Description)
    .Analyzer("standard")
    .Boost(1.1)
    .CutoffFrequency(0.001)
    .DisableCoord()
    .HighFrequencyOperator(Operator.And)
    .LowFrequencyOperator(Operator.Or)
    .MinimumShouldMatch(1)
    .Name("named_query")
    .Query("nelly the elephant not as a")
)

Object Initializer syntax example

edit
new CommonTermsQuery()
{
    Field = Field<Project>(p => p.Description),
    Analyzer = "standard",
    Boost = 1.1,
    CutoffFrequency = 0.001,
    DisableCoord = true,
    HighFrequencyOperator = Operator.And,
    LowFrequencyOperator = Operator.Or,
    MinimumShouldMatch = 1,
    Name = "named_query",
    Query = "nelly the elephant not as a"
}

Example json output.

{
  "common": {
    "description": {
      "_name": "named_query",
      "boost": 1.1,
      "query": "nelly the elephant not as a",
      "cutoff_frequency": 0.001,
      "low_freq_operator": "or",
      "high_freq_operator": "and",
      "minimum_should_match": 1,
      "analyzer": "standard",
      "disable_coord": true
    }
  }
}