How to highlight any field in document which contain searched string?


(Rudolf “Reddy” Macejka) #1

Hello,

I am trying to build a full-text search query over thousand of documents with dynamic structure.

But the highlight method works only for specifically named fields.

If I want to use search over _all or _source it doesn't show any hihlighted result.

I already tried many various and tried to "googling" but with no success.

Basic query:

POST tracking*/_search
{
    "query": {
    "query_string": {
      "query": "ci1483967534008.6100622@czcholsint372_te"
    }
  },
  "highlight": {
    "require_field_match": false
  }
}

will return:

  "hits": {
    "total": 8,
    "max_score": 13.482396,
    "hits": [
      {
        "_index": "tracking-2017.01.09",
        "_type": "cyclone",
        "_id": "Cyclone1-UAT-ci1483967534008.6100622@czcholsint372_te-Messaging.Message.MessageUnpackaged.Request",
        "_score": 13.482396,
        "_source": {
        ... truncated ...
          "received": "2017-01-09T13:12:14.008Z",
          "tags": [],
          "@timestamp": "2017-01-09T13:12:14.008Z",
          "size": "3169",
          "pairing": " ci1483967534008.6100622@czcholsint372_te <60a93b9-159835b287e-159835b79041a66cd1@ip.net> ErpExJets_RDC1_ProcessPurchaseOrder_9.4.1_20170109131207169 ErpExJets_RDC1_ProcessPurchaseOrder_9.4.1_20170109131207169",
        }
      },

but no highlight even if the searched string is in the pairing field.

Is it possible at all?

Thanks
Reddy


(Nik Everett) #2

If the documents have truly dynamic structure you might want to normalize
it somehow. Elasticsearch doesn't do well with tens of thousands of sparse
fields. Each one has an overhead, etc. You can highlight against "*" but
that will try each one, one after the other so it isn't particularly
efficient.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.