# How to export csv when \_source is disabled

**URL:** https://discuss.elastic.co/t/how-to-export-csv-when-source-is-disabled/243150
**Category:** Kibana
**Created:** [July 30, 2020, 3:27am UTC](https://discuss.elastic.co/t/how-to-export-csv-when-source-is-disabled/243150 "2020-07-30T03:27:58Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![t98907](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/t98907/32/80243_2.png) [@t98907](https://discuss.elastic.co/u/t98907)
#### Post date: [July 30, 2020, 3:27am UTC](https://discuss.elastic.co/t/how-to-export-csv-when-source-is-disabled/243150/1 "2020-07-30T03:27:58Z")

</div>

Hi there,

I looked into the reason why kibana can't export csv.  
It was because I had \_source disabled in my index, so I couldn't export csv with kibana.

But I'm storing the fields I need, and discover is outputting the values.

Is there a way to export csv even if \_source is disabled?

Thank you,

---

<div class="post-metadata">

### Author: ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)
#### Post date: [July 30, 2020, 8:12pm UTC](https://discuss.elastic.co/t/how-to-export-csv-when-source-is-disabled/243150/2 "2020-07-30T20:12:34Z")

</div>

Hello,

This is interesting. I disabled source on a sample index and printed out the CSV. Granted it was of not much use because my ingested data was pretty dummy.

Can you please let me know how are you disabling the source and do you have permissions to print CSVs?

Thanks,  
Bhavya

---

<div class="post-metadata">

### Author: ![t98907](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/t98907/32/80243_2.png) [@t98907](https://discuss.elastic.co/u/t98907)
#### Post date: [August 4, 2020, 4:38am UTC](https://discuss.elastic.co/t/how-to-export-csv-when-source-is-disabled/243150/3 "2020-08-04T04:38:40Z")

</div>

Hi,

Thanks for the reply. The kibana log was as follows:

```
{"type":"log","@timestamp":"2020-08-04T04:23:52Z","tags":["info","reporting","savedobject-csv","csv_from_savedobject","execute-job","immediate"],"pid":7,"message":"Executing job from Immediate API using request context"}
{"type":"log","@timestamp":"2020-08-04T04:23:52Z","tags":["error","reporting","savedobject-csv"],"pid":7,"message":"{ Error: [illegal_argument_exception] unable to fetch fields from _source field: _source is disabled in the mappings for index [job-202007201811]\n at respond (/usr/share/kibana/node_modules/elasticsearch/src/lib/transport.js:349:15)\n at checkRespForFailure (/usr/share/kibana/node_modules/elasticsearch/src/lib/transport.js:306:7)\n at HttpConnector.<anonymous> (/usr/share/kibana/node_modules/elasticsearch/src/lib/connectors/http.js:173:7)\n at IncomingMessage.wrapper (/usr/share/kibana/node_modules/elasticsearch/node_modules/lodash/lodash.js:4929:19)\n at IncomingMessage.emit (events.js:203:15)\n at endReadableNT (_stream_readable.js:1145:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)\n status: 400,\n displayName: 'BadRequest',\n message:\n '[illegal_argument_exception] unable to fetch fields from _source field: _source is disabled in the mappings for index [job-202007201811]',\n path: '/job/_search',\n query: { scroll: '30s', size: 500 },\n body:\n { error:\n { root_cause: [Array],\n type: 'search_phase_execution_exception',\n reason: 'all shards failed',\n phase: 'fetch',\n grouped: true,\n failed_shards: [Array],\n caused_by: [Object] },\n status: 400 },\n statusCode: 400,\n response:\n '{\"error\":{\"root_cause\":[{\"type\":\"illegal_argument_exception\",\"reason\":\"unable to fetch fields from _source field: _source is disabled in the mappings for index [job-202007201811]\"}],\"type\":\"search_phase_execution_exception\",\"reason\":\"all shards failed\",\"phase\":\"fetch\",\"grouped\":true,\"failed_shards\":[{\"shard\":0,\"index\":\"job-202007201811\",\"node\":\"6-g-PYqpQgeJ8P_SuApQ9Q\",\"reason\":{\"type\":\"illegal_argument_exception\",\"reason\":\"unable to fetch fields from _source field: _source is disabled in the mappings for index [job-202007201811]\"}}],\"caused_by\":{\"type\":\"illegal_argument_exception\",\"reason\":\"unable to fetch fields from _source field: _source is disabled in the mappings for index [job-202007201811]\",\"caused_by\":{\"type\":\"illegal_argument_exception\",\"reason\":\"unable to fetch fields from _source field: _source is disabled in the mappings for index [job-202007201811]\"}}},\"status\":400}',\n toString: [Function],\n toJSON: [Function] }"}
{"type":"log","@timestamp":"2020-08-04T04:23:52Z","tags":["error","reporting","savedobject-csv","csv_from_savedobject","execute-job","immediate"],"pid":7,"message":"Generate CSV Error! [illegal_argument_exception] unable to fetch fields from _source field: _source is disabled in the mappings for index [job-202007201811] :: {\"path\":\"/job/_search\",\"query\":{\"scroll\":\"30s\",\"size\":500},\"body\":\"{\\\"_source\\\":{\\\"includes\\\":[\\\"orderDate\\\",\\\"jutakuNo\\\",\\\"company\\\",\\\"head\\\"]},\\\"docvalue_fields\\\":[\\\"orderDate\\\",{\\\"field\\\":\\\"orderDate\\\",\\\"format\\\":\\\"date_time\\\"}],\\\"query\\\":{\\\"bool\\\":{\\\"must\\\":[{\\\"match_all\\\":{}}],\\\"filter\\\":[{\\\"range\\\":{\\\"orderDate\\\":{\\\"format\\\":\\\"strict_date_time\\\",\\\"gte\\\":\\\"2020-07-28T13:23:51+09:00\\\",\\\"lte\\\":\\\"2020-08-04T13:23:51+09:00\\\"}}},{\\\"bool\\\":{\\\"must\\\":[{\\\"match_all\\\":{}},{\\\"match_all\\\":{}}],\\\"filter\\\":[{\\\"range\\\":{\\\"orderDate\\\":{\\\"gte\\\":\\\"2020-07-28T04:23:51.910Z\\\",\\\"lte\\\":\\\"2020-08-04T04:23:51.911Z\\\",\\\"format\\\":\\\"strict_date_optional_time\\\"}}}],\\\"should\\\":[],\\\"must_not\\\":[]}}],\\\"should\\\":[],\\\"must_not\\\":[]}},\\\"script_fields\\\":{},\\\"sort\\\":[{\\\"orderDate\\\":{\\\"order\\\":\\\"desc\\\",\\\"unmapped_type\\\":\\\"boolean\\\"}},{\\\"orderDate\\\":{\\\"order\\\":\\\"desc\\\"}}]}\",\"statusCode\":400,\"response\":\"{\\\"error\\\":{\\\"root_cause\\\":[{\\\"type\\\":\\\"illegal_argument_exception\\\",\\\"reason\\\":\\\"unable to fetch fields from _source field: _source is disabled in the mappings for index [job-202007201811]\\\"}],\\\"type\\\":\\\"search_phase_execution_exception\\\",\\\"reason\\\":\\\"all shards failed\\\",\\\"phase\\\":\\\"fetch\\\",\\\"grouped\\\":true,\\\"failed_shards\\\":[{\\\"shard\\\":0,\\\"index\\\":\\\"job-202007201811\\\",\\\"node\\\":\\\"6-g-PYqpQgeJ8P_SuApQ9Q\\\",\\\"reason\\\":{\\\"type\\\":\\\"illegal_argument_exception\\\",\\\"reason\\\":\\\"unable to fetch fields from _source field: _source is disabled in the mappings for index [job-202007201811]\\\"}}],\\\"caused_by\\\":{\\\"type\\\":\\\"illegal_argument_exception\\\",\\\"reason\\\":\\\"unable to fetch fields from _source field: _source is disabled in the mappings for index [job-202007201811]\\\",\\\"caused_by\\\":{\\\"type\\\":\\\"illegal_argument_exception\\\",\\\"reason\\\":\\\"unable to fetch fields from _source field: _source is disabled in the mappings for index [job-202007201811]\\\"}}},\\\"status\\\":400}\"}"}
{"type":"error","@timestamp":"2020-08-04T04:23:51Z","tags":[],"pid":7,"level":"error","error":{"message":"[illegal_argument_exception] unable to fetch fields from _source field: _source is disabled in the mappings for index [job-202007201811]","name":"Error","stack":"Error: [illegal_argument_exception] unable to fetch fields from _source field: _source is disabled in the mappings for index [job-202007201811]\n at respond (/usr/share/kibana/node_modules/elasticsearch/src/lib/transport.js:349:15)\n at checkRespForFailure (/usr/share/kibana/node_modules/elasticsearch/src/lib/transport.js:306:7)\n at HttpConnector.<anonymous> (/usr/share/kibana/node_modules/elasticsearch/src/lib/connectors/http.js:173:7)\n at IncomingMessage.wrapper (/usr/share/kibana/node_modules/elasticsearch/node_modules/lodash/lodash.js:4929:19)\n at IncomingMessage.emit (events.js:203:15)\n at endReadableNT (_stream_readable.js:1145:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)"},"url":{"protocol":null,"slashes":null,"auth":null,"host":null,"port":null,"hostname":null,"hash":null,"search":null,"query":{},"pathname":"/api/reporting/v1/generate/immediate/csv/saved-object/search:901b67a0-25ba-11e8-8735-1dd0f5e7cc80","path":"/api/reporting/v1/generate/immediate/csv/saved-object/search:901b67a0-25ba-11e8-8735-1dd0f5e7cc80","href":"/api/reporting/v1/generate/immediate/csv/saved-object/search:901b67a0-25ba-11e8-8735-1dd0f5e7cc80"},"message":"[illegal_argument_exception] unable to fetch fields from _source field: _source is disabled in the mappings for index [job-202007201811]"}

```

In the job-202007201811 index schema, \_source is defined as follows:

```auto
    ...
      "mappings": {
        "_doc": {
          "dynamic": false,
          "_source": {
            "enabled": false
          },
    ...

```

The roles of dashboard-only and reporting\_user are assigned to kibana users.

Thank you,

---

<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: [September 1, 2020, 4:38am UTC](https://discuss.elastic.co/t/how-to-export-csv-when-source-is-disabled/243150/4 "2020-09-01T04:38:41Z")

</div>

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