GroupedPayloadSpanQuery

De JDONREF Wiki

Ensure tokens with same payload values are grouped together.

For example, the document :

 { "fullName": "BOULEVARD|1 DE|1 PARIS|1 L|2 HOPITAL|2" }

indexed with a mapping like :

 "fullName" : {"type": "string", "term_vector" : "with_positions_offsets_payloads", "index_analyzer":"myAnalyzer"}

and settings like :

 {
   "index" : {
       "analysis" : {
           "analyzer": {
               "myAnalyzer" : {
                   "type" : "custom",
                   "tokenizer" : "whitespace",
                   "filter" : ["delimited_payload_filter", "lowercase"]
               },
           "filter" : {
               "delimited_payload_filter" : {
                 "type": "delimited_payload_filter",
                 "delimiter" : "|",
                 "encoding" : "int"
               }
       }
 }

will not match the request :

 curl -XPOST 'http://localhost:9200/_search' -d '{
   "query": {
     "span_groupedpayload" : {
       "clauses" : [
          { "span_multipayloadterm" : { "fullName" : "BOULEVARD"}} ,
          { "span_multipayloadterm" :{ "fullName" : "HOPITAL"}} ,
          { "span_multipayloadterm" :{ "fullName" : "PARIS"}}
       ]
     }
   }
 }'

because token HOPITAL break the group of payload values from BOULEVARD and PARIS.

the clauses element must be a list of one or more span_multipayloadterm type queries.