How to remove specific response body content in Elasticsearch


(Muthu Kutty) #1

My response body from Elasticsearch is

{
  "took": 67,
  "timed_out": false,
  "_shards": {
    "total": 331,
    "successful": 331,
    "skipped": 321,
    "failed": 0
  },
  "hits": {
    "total": 5344,
    "max_score": 4.2037153,
    "hits": [
      {
        "_index": "Test-2018.03.22",
        "_type": "Emp",
        "_id": "df4354yy5465645tytryytI",
        "_score": 4.2037153,
        "_source": {
          "time": "2018-03-22T12:46:39.6259805Z",
          "Sample": "Info",
          "Active": "Avaliable",
          "ProcessCheck1": "0",
          "ProgramId2": "0",
        }
      },
      ]
      }
      }

Is there a way to remove them so i can have the following structure,

{

  "hits": {
    "total": 5344,
    "hits": [
      {
        "_source": {
          "time": "2018-03-22T12:46:39.6259805Z",
          "Sample": "Info",
        }
      },
      ]
      }
      }

(David Pilato) #2

Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.
Please update your post.

Anyway, read https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-source-filtering.html


(Muthu Kutty) #3

Thanks for u'r information dadoonetDavid,

i have Edited...


(system) closed #4

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