Highlighting object type field


(Shai Erera) #1

Is it possible to highlight an Object type field? It doesn't seem to work for me, and there's nothing in the docs that says it shouldn't work. Specifically, I index documents with sections in them, and I defined my mapping to have a sections field of type Object, with two sub-fields: "title" and "text". I can successfully search the fields sections.title and sections.text, they are returned in the _source (I also tried to explicitly store them).

When I search and request to highlight the sections.text field, I get no highlights at all (no even an empty response object). This is my request:

  "highlight": {
    "fragment_size": 100,
    "number_of_fragments": 3,
    "type": "unified",
    "boundary_scanner": "SENTENCE",
    "fields": {
      "sections.text": {}
    }
  }```

If I change the field to highlight on another textual field, not `Object` it works, so it definitely has to do with the Object datatype.

Is this supposed to work?

(Shai Erera) #2

Ugh, sorry it looks like I had a problem with my search query -- the match was found in another field than the one I wanted to highlight (and actually search on!). I fixed that and now it works.