# Index "\_source.enabled": false does not remove source data and index size does not change at all due to this setting

**URL:** <https://discuss.elastic.co/t/index-source-enabled-false-does-not-remove-source-data-and-index-size-does-not-change-at-all-due-to-this-setting/272677>\
**Category:** Elasticsearch\
**Created:** [May 11, 2021, 10:43am UTC](https://discuss.elastic.co/t/index-source-enabled-false-does-not-remove-source-data-and-index-size-does-not-change-at-all-due-to-this-setting/272677 "2021-05-11T10:43:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![raulk89](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@raulk89](https://discuss.elastic.co/u/raulk89)\
**Post date:** [May 11, 2021, 10:43am UTC](https://discuss.elastic.co/t/index-source-enabled-false-does-not-remove-source-data-and-index-size-does-not-change-at-all-due-to-this-setting/272677/1 "2021-05-11T10:43:09Z")

</div>

Hi

Elastic 7.11.2

I am indexing documents through pipelines (using ingest\_attachment plugin)

My pipeline looks like this:

```
PUT _ingest/pipeline/my_pipeline
{
    "description": "pipeline for indexing documents",
    "processors": [
        {
            "attachment": {
                "target_field": "attachment",
                "field": "sisu",
                "indexed_chars": -1
            }
        }
    ]
}

```

Field "sisu" is html document source and encoded with base64, so after indexing it does look like this:

> "\_source" : {  
> .....  
> "sisu" : "77u/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhRE9DVFlQRSBodG1sID4NCjxodG1sPg0KICA8aGVhZD4NCiAgICA8c3R5bGU+DQppbWcgew0KICAgIC1raHRtbC1.............."  
> }

Now when I create 2 indexes. One has source enabled and other has source disabled.

```
PUT myidx_src_enabled
{
    "mappings": {
        "dynamic": false,
        "_source": { "enabled": true },
        "properties": {
            "kohtuasjaObjektId": { "type": "integer" },
            "menetluseObjektId": { "type": "integer" },
            "failiId": { "type": "integer" },
            "lehekyljeId": { "type": "integer" },
            "lkNumber": { "type": "integer" },
            "sisu": { "type": "text", "index": false },
            "attachment": {
                "properties": {
                    "content": { "type": "text" }
                }
            }
        }
    }
}

```

I will index single html document, which is 35kb in size  
And my index is 39.8kb in size

Now I will create new index with source disabled

```
PUT myidx_src_disabled
{
    "mappings": {
        "dynamic": false,
        "_source": { "enabled": false },
        "properties": {
            "kohtuasjaObjektId": { "type": "integer" },
            "menetluseObjektId": { "type": "integer" },
            "failiId": { "type": "integer" },
            "lehekyljeId": { "type": "integer" },
            "lkNumber": { "type": "integer" },
            "sisu": { "type": "text", "index": false },
            "attachment": {
                "properties": {
                    "content": { "type": "text" }
                }
            }
        }
    }
}

```

I will index single html document, which is the exact same document 35kb in size  
And my index size is the same 39.8kb

I have tried:

- Disabling source:  
"\_source": { "enabled": false },
- Specifying "store": false for the "sisu"  
"sisu": { "type": "text", "index": false, "store": false},
- Removing whole "sisu" mapping althogether  
So removing this row: "sisu": { "type": "text", "index": false },

It does not matter what I do, either way seems like this "sisu" is still present there and this size does not change at all.

Am I doing something wrong..?

Regards  
Raul

---

<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:** [May 11, 2021, 3:38pm UTC](https://discuss.elastic.co/t/index-source-enabled-false-does-not-remove-source-data-and-index-size-does-not-change-at-all-due-to-this-setting/272677/2 "2021-05-11T15:38:03Z")

</div>

My advice would be to add a `remove` processor after the `attachment` processor and totally remove the field `sisu`.

---

<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:** [June 8, 2021, 3:38pm UTC](https://discuss.elastic.co/t/index-source-enabled-false-does-not-remove-source-data-and-index-size-does-not-change-at-all-due-to-this-setting/272677/3 "2021-06-08T15:38:18Z")

</div>

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