Skip to content

Fast vector highlighting span queries for nested documents #24318

@jane-saunders-hpe

Description

@jane-saunders-hpe

Elasticsearch version: 5.3.1

Plugins installed: [mapper-murmur3, mapper-size, x-pack]

JVM version: OpenJDK 1.8.0_131

OS version: CentOS Linux release 7.3.1611 (Core)

Description of the problem including expected versus actual behavior:
Fast vector highlighting does not work on a nested document, with span_near or span_first queries (additional span queries may be affected)

Steps to reproduce:
1.

PUT /test
{
  "settings" : {
    "index" : {
      "number_of_shards" : 1,
      "number_of_replicas" : 0
    }
  },
  "mappings" : {
    "object" : {
      "properties" : {
        "document_part" : {
          "type" : "nested",
          "properties": {
            "text": {
              "type": "text",
              "term_vector": "with_positions_offsets"
            }
          }

        }

      }
    }
  }
}
POST /test/object/1
{
  "document_part": {
    "text": "Here is some text to be analyzed and later queried on.  Let us use everyones favourite... The cat sat on the mat near the dog.  The cat saw the dog."
  }
}
GET /test/object/_search
{
  "_source": false,
  "query": {
    "nested": {
      "path": "document_part",
      "query": {
        "span_near": {
          "clauses": [
            {
              "span_term": { "document_part.text": "cat" }
            },
            {
              "span_term": { "document_part.text": "dog" }
            }
          ],
          "slop": 5,
          "in_order": false
        }
      },
      "inner_hits": {
        "_source": false,
        "highlight": {
          "fields": {"document_part.text": {}}
        }
      }
    }
  }
}
  1. Note that in the response the _search in step 3, a hit is found, but no higlight. With just a span_term query the highlight is seen. And forcing the highlight type to be "plain" the highlight is seen.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions