# Whole attachment in \_source when searching attachments

**URL:** <https://discuss.elastic.co/t/whole-attachment-in--source-when-searching-attachments/51552>\
**Category:** Elasticsearch\
**Created:** [June 1, 2016, 12:02pm UTC](https://discuss.elastic.co/t/whole-attachment-in--source-when-searching-attachments/51552 "2016-06-01T12:02:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thigg](https://avatars.discourse-cdn.com/v4/letter/t/a88e4f/32.png) [@thigg](https://discuss.elastic.co/u/thigg)\
**Post date:** [June 1, 2016, 12:02pm UTC](https://discuss.elastic.co/t/whole-attachment-in--source-when-searching-attachments/51552/1 "2016-06-01T12:02:57Z")

</div>

I am basically indexing pdfs.

Then I am searching them and I am using the highlight field to preview the search results.

The problem is, that for each search query, I am getting the whole attachment back in the \_source field.  
Is there a way to disable this?

My search query:

```
POST /documents/document/_search
{
  "query": {
    "multi_match": {
      "query": "Fault",
      "fields": ["author^2","tags","doc.content"]
    }},
    "highlight" : {
        "fields" : {
            "*" : {}
        } 
    }
  }

```

And my schema:

```
POST /documents
{
  "mappings": {
    "document": {
      "properties": {
        "doc": {
          "type": "attachment",
          "fields": {
            "content": {
              "type": "string",
              "term_vector": "with_positions_offsets",
              "store": true
            }
          }
        },
        "author": {
          "type": "string"
        },
        "pub_date": {
          "type": "date"
        },
        "tags": {
          "type": "string"
        }
      }
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 1, 2016, 12:24pm UTC](https://discuss.elastic.co/t/whole-attachment-in--source-when-searching-attachments/51552/2 "2016-06-01T12:24:04Z")

</div>

You can use source filtering: [https://www.elastic.co/guide/en/elasticsearch/reference/2.3/search-request-source-filtering.html](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/search-request-source-filtering.html)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:47pm UTC](https://discuss.elastic.co/t/whole-attachment-in--source-when-searching-attachments/51552/3 "2017-07-05T22:47:16Z")

</div>


