Failed to execute 'Download CSV'

Hi there,

Kibana: 7.8.0

'Download CSV' failed even though I am logged in as 'elastic' user.
Must '_source' be enabled on the index to run 'Download CSV'?

If there was an error, posting that would be helpful.
Also check your Kibana logs.

I got the following errors below:

{"type":"log","@timestamp":"2020-12-04T02:14:54Z","tags":["info","reporting","savedobject-csv","csv_from_savedobject","execute-job","immediate"],"pid":6,
 "message":"Executing job from Immediate API using request context"}

{"type":"log","@timestamp":"2020-12-04T02:14:54Z","tags":["error","reporting","savedobject-csv"],"pid":6,
  "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\":\"d36cNRY0QVeWiqXAteFy3g\",\"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-12-04T02:14:54Z","tags":["error","reporting","savedobject-csv","csv_from_savedobject","execute-job","immediate"],"pid":6,
  "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-11-27T11:14:54+09:00\\\",\\\"lte\\\":\\\"2020-12-04T11:14:54+09:00\\\"}}},{\\\"bool\\\":{\\\"must\\\":[{\\\"match_all\\\":{}},{\\\"match_all\\\":{}}],\\\"filter\\\":[{\\\"range\\\":{\\\"orderDate\\\":{\\\"gte\\\":\\\"2020-11-27T02:14:54.686Z\\\",\\\"lte\\\":\\\"2020-12-04T02:14:54.686Z\\\",\\\"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\\\":\\\"d36cNRY0QVeWiqXAteFy3g\\\",\\\"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-12-04T02:14:54Z","tags":[],"pid":6,"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]"}

{"type":"response","@timestamp":"2020-12-04T02:14:54Z","tags":["api"],"pid":6,"method":"post","statusCode":500,"req":{"url":"/api/reporting/v1/generate/immediate/csv/saved-object/search:901b67a0-25ba-11e8-8735-1dd0f5e7cc80","method":"post","headers":{"host":"brain.intra.sunflare.co.jp","connection":"upgrade","x-real-ip":"172.16.16.220","x-forwarded-server":"brain.intra.sunflare.co.jp","x-forwarded-for":"172.16.16.220","content-length":"474","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0","accept":"*/*","accept-language":"ja,en-US;q=0.7,en;q=0.3","accept-encoding":"gzip, deflate, br","referer":"https://brain.intra.sunflare.co.jp/kizashi-admin/app/kibana","content-type":"application/json","kbn-version":"7.8.0","origin":"https://brain.intra.sunflare.co.jp"},"remoteAddress":"172.19.0.13","userAgent":"172.19.0.13","referer":"https://brain.intra.sunflare.co.jp/kizashi-admin/app/kibana"},"res":{"statusCode":500,"responseTime":306,"contentLength":9},
  "message":"POST /api/reporting/v1/generate/immediate/csv/saved-object/search:901b67a0-25ba-11e8-8735-1dd0f5e7cc80 500 306ms - 9.0B"}

That's why, you need _source enabled as you originally asked.

Thanks for reply.

Even if _source is disabled, the search results are still displayed correctly, so it would be normal to be able to download the CSV as well.

I can't comment on that, but I would suggest there's architectural requirements for why it's the way it is.

Hmmm, that's too bad.
Thank you.