[[java-query-dsl-span-within-query]]
==== Span Within Query

See {ref}/query-dsl-span-within-query.html[Span Within Query]

[source,java]
--------------------------------------------------
QueryBuilder qb = spanWithinQuery()
    .little(spanTermQuery("field1", "foo"))                 <1>
    .big(spanNearQuery()                                    <2>
                    .clause(spanTermQuery("field1", "bar"))
                    .clause(spanTermQuery("field1", "baz"))
                    .slop(5)
                    .inOrder(true)
    );
--------------------------------------------------
<1> `little` part
<2> `big` part
