Link Menu Search Expand Document

Elasticsearch

Table of contents

  1. List indices
  2. Search with highlights

List indices

GET /_cat/indices?v

Search with highlights

In order for the highlight field to return all the data in the target field, set the number_of_fragments option to 0. For example:

GET /idx/_search
{
  "size": 1, 
  "_source": ["field1", "field2", "field3","field4"], 
  "query": {
    "regexp": {
      "field1": ".*whatever.*"
    }
  },
  "highlight": {
    "fields": {
      "field1": {"number_of_fragments" : 0}
    } 
  },
  "sort": [
    {
      "field4": {
        "order": "desc"
      }
    }
  ]
}

Gilgalab Knowledge Base