Span Not Query Usage

edit

Fluent DSL example

edit
q
.SpanNot(sn => sn
    .Name("named_query")
    .Boost(1.1)
    .Dist(12)
    .Post(13)
    .Pre(14)
    .Include(i => i
        .SpanTerm(st => st.Field("field1").Value("hoya"))
    )
    .Exclude(e => e
        .SpanTerm(st => st.Field("field1").Value("hoya2"))
    )
)

Object Initializer syntax example

edit
new SpanNotQuery
{
    Name = "named_query",
    Boost = 1.1,
    Dist = 12,
    Post = 13,
    Pre = 14,
    Include = new SpanQuery
    {
        SpanTerm = new SpanTermQuery
        {
            Field = "field1", Value = "hoya"
        }
    },
    Exclude = new SpanQuery
    {
        SpanTerm = new SpanTermQuery
        {
            Field = "field1", Value = "hoya2"
        }
    },
}

Example json output.

{
  "span_not": {
    "_name": "named_query",
    "boost": 1.1,
    "include": {
      "span_term": {
        "field1": {
          "value": "hoya"
        }
      }
    },
    "exclude": {
      "span_term": {
        "field1": {
          "value": "hoya2"
        }
      }
    },
    "pre": 14,
    "post": 13,
    "dist": 12
  }
}