No highlights returned (ES 2.1, attachment-mapper 3.1.0)


(David Pocivalnik) #1

Hi,

I've used and had highlights before (via Java API), but lost it with some ES upgrade, can't remember which one though.

Now I'm using ES 2.1 with the corresponding attachments-mapper plug-in (3.1.0).

I followed the steps provided at https://github.com/elastic/elasticsearch-mapper-attachments/tree/es-2.1 in order to make sure it's working at all, but the result I get is without any highlights (as opposed to the sample provided)

     {
  "took": 3,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 1,
    "max_score": 1,
    "hits": [
      {
        "_index": "test",
        "_type": "person",
        "_id": "1",
        "_score": 1,
        "_source": {
          "file": "IkdvZCBTYXZlIHRoZSBRdWVlbiIgKGFsdGVybmF0aXZlbHkgIkdvZCBTYXZlIHRoZSBLaW5nIg=="
        }
      }
    ]
  }
}

Any idea what I'm missing here?

EDIT:

I just checked with ES 2.2.1 and corresponding attachment-mapper plug-in (bin/plugin install mapper-attachments) and followed the same steps, but the same result as before.

EDIT2:

The problem was that I had to use POST as method, not GET as it's said in the instructions I linked to above. (I'ved used the Firefox plug-in RestClient and the head-plug-in)

The problem I have now is that I want to do the following: Instead of having a match query I have a query_string query, and with this one I'm getting the matching documents, but no highlights. I didn't try the match query within Java, but using the query_string query within Java has the same behavior, I'm getting the matching docs, but no highlights.

{
  "fields": [],
  "query": {
    "query_string": {
      "query": "king queen"
    }
  },
  "highlight": {
    "fields": {
      "file.content": {
      }
    }
  }
}

(system) #2