Span Queries (first, near, not, or, term)

See: * Span Term Query * Span First Query * Span Near Query * Span Not Query * Span Or Query

// Span Term
QueryBuilder qb = spanTermQuery(
    "user",                                     
    "kimchy"                                    
);

field

value

// Span First
QueryBuilder qb = spanFirstQuery(
    spanTermQuery("user", "kimchy"),            
    3                                           
);

query

max end position

// Span Near
QueryBuilder qb = spanNearQuery()
    .clause(spanTermQuery("field","value1"))    
    .clause(spanTermQuery("field","value2"))    
    .clause(spanTermQuery("field","value3"))    
    .slop(12)                                   
    .inOrder(false)                             
    .collectPayloads(false);                    

span term queries

slop factor: the maximum number of intervening unmatched positions

whether matches are required to be in-order

collect payloads or not

// Span Not
QueryBuilder qb = spanNotQuery()
    .include(spanTermQuery("field","value1"))   
    .exclude(spanTermQuery("field","value2"));  

span query whose matches are filtered

span query whose matches must not overlap those returned

// Span Or
QueryBuilder qb = spanOrQuery()
    .clause(spanTermQuery("field","value1"))    
    .clause(spanTermQuery("field","value2"))    
    .clause(spanTermQuery("field","value3"));   

span term queries