# Error when exporting more than 1000 saved objects

**URL:** <https://discuss.elastic.co/t/error-when-exporting-more-than-1000-saved-objects/317497>\
**Category:** Kibana\
**Tags:** docker\
**Created:** [October 26, 2022, 9:45am UTC](https://discuss.elastic.co/t/error-when-exporting-more-than-1000-saved-objects/317497 "2022-10-26T09:45:57Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonas27](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@jonas27](https://discuss.elastic.co/u/jonas27)\
**Post date:** [October 26, 2022, 9:45am UTC](https://discuss.elastic.co/t/error-when-exporting-more-than-1000-saved-objects/317497/1 "2022-10-26T09:45:57Z")

</div>

Hi, I am hitting an error in our infrastructure when exporting more than =\< 1000 saved objects (visualizations in particular) from either the API or inside the dev tools. However, when exporting the same objects via a list of IDs with the rest API it works.

The error is as follows

```auto
{"statusCode":400,"error":"Bad Request","message":"all shards failed: search_phase_execution_exception: [parse_exception] Reason: failed to parse date field [-9223372036854776000] with format [strict_date_optional_time||epoch_millis]: [failed to parse date field [-9223372036854776000] with format [strict_date_optional_time||epoch_millis]]"}

```

which seems more like an elastic error and is sort of cryptic to me, especially because all visualizations are exportable via ID.

Decreasing the savedObjects.maxImportExportSize leads to the expected error of reaching the max export size.

Thanks for any help 🙂

---

<div class="post-metadata">

**Author:** ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)\
**Post date:** [October 27, 2022, 11:45am UTC](https://discuss.elastic.co/t/error-when-exporting-more-than-1000-saved-objects/317497/2 "2022-10-27T11:45:41Z")

</div>

What version of the stack are you running. As per comments [here](https://github.com/elastic/kibana/issues/116106#issuecomment-989487848) the API was improved at [PR #89915](https://github.com/elastic/kibana/pull/89915) and the UI at [PR #118335](https://github.com/elastic/kibana/pull/118335).

---

<div class="post-metadata">

**Author:** ![jonas27](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@jonas27](https://discuss.elastic.co/u/jonas27)\
**Post date:** [October 27, 2022, 1:00pm UTC](https://discuss.elastic.co/t/error-when-exporting-more-than-1000-saved-objects/317497/3 "2022-10-27T13:00:04Z")

</div>

Hi @jsanz, the cluster is running on 7.17.6 (es and kibana) so the fix should be included.  
It also seems to fix the issue of exporting more than 10,000 saved objects, but here its only 1,000.

---

<div class="post-metadata">

**Author:** ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)\
**Post date:** [October 27, 2022, 3:48pm UTC](https://discuss.elastic.co/t/error-when-exporting-more-than-1000-saved-objects/317497/4 "2022-10-27T15:48:14Z")

</div>

Hi sorry my bad I missed a zero on your first post.

I tested on 7.17 and I could repeatedly export and import my saved objects up to 40K. That is, start fresh, import saved objects from filebeat, packetbeat, and metricbeat to have 1.2K objects and then repeatedly export all of them and import them again to double my objects with the `Create new objects with random IDs` option in the importer.

By default you cannot export more than 10K so I upp'ed my settings like this:

```auto
savedObjects.maxImportExportSize: 100000
savedObjects.maxImportPayloadBytes: 104857600
server.maxPayloadBytes: 104857600

```

The last export of 20k docs needed a bit of time both ways export and import, but it eventually finished so I ended up with my (bloated) Kibana of 41160 saved objects.

![image](https://us1.discourse-cdn.com/elastic/original/3X/1/9/1966ea3857b3225fbf7dacb20067529bb36f783d.png)

Do you see anything in your logs apart from that line you shared? Did you export from identifiers ALL the saved objects? It seems more related with an specific saved object that crashed the process, rather than the bulk operation.

---

<div class="post-metadata">

**Author:** ![jonas27](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@jonas27](https://discuss.elastic.co/u/jonas27)\
**Post date:** [October 31, 2022, 6:26am UTC](https://discuss.elastic.co/t/error-when-exporting-more-than-1000-saved-objects/317497/5 "2022-10-31T06:26:52Z")

</div>

Hi sorry for the delayed response.

No that is the problem, I am not seeing any problems apart from the error above.  
But it seems unrelated to any restriction on the number of bytes because it happens exactly at the 1,000 mark.

I tested the download of all objects doing with the code below and it works.

```auto
ids=$(curl -s "$URL"'/api/kibana/management/saved_objects/_find?perPage=2000&page=1&fields=id&type=visualization' -H 'content-type: application/json' -H 'kbn-version: 7.17.6' --compressed | ./jq -r '.saved_objects[].id')
echo "visualization count is $(echo $ids | wc)"

obj='{"objects": [],"includeReferencesDeep":false}'
while read -r id; do
    obj=$(echo $obj | ./jq '.objects[.objects| length] |= . + {"id":"'"$id"'","type":"visualization"}')
done <<EOF
$ids
EOF

curl -s "$URL"'/api/saved_objects/_export' -H 'kbn-version: 7.17.6' -H 'accept: */*' -H 'content-type: application/json' --data-raw "$obj" --compressed 

```

---

<div class="post-metadata">

**Author:** ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)\
**Post date:** [October 31, 2022, 3:59pm UTC](https://discuss.elastic.co/t/error-when-exporting-more-than-1000-saved-objects/317497/6 "2022-10-31T15:59:13Z")

</div>

Aren't you using the [Kibana API](https://www.elastic.co/guide/en/kibana/7.17/saved-objects-api-find.html) for saved objects?

I see you are querying `/api/kibana/management/saved_objects/_find` instead of `/api/saved_objects/_find`. Have you noticed the same issue in both APIs? The one you are using is meant to only be used by the Kibana application, not by third party integrations.

---

<div class="post-metadata">

**Author:** ![jonas27](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@jonas27](https://discuss.elastic.co/u/jonas27)\
**Post date:** [November 2, 2022, 6:17am UTC](https://discuss.elastic.co/t/error-when-exporting-more-than-1000-saved-objects/317497/7 "2022-11-02T06:17:18Z")

</div>

yes I do. I used the api only to confirm the error and that the error only happens when querying the all objects api but not when querying the api with individual IDs.

The error from the ui and also from the api is the same however.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/b/4bea6fe6f8faed55256dacdfad32d68e4144f1fc.png)

---

<div class="post-metadata">

**Author:** ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)\
**Post date:** [November 2, 2022, 12:57pm UTC](https://discuss.elastic.co/t/error-when-exporting-more-than-1000-saved-objects/317497/8 "2022-11-02T12:57:58Z")

</div>

At this point I'm afraid I can only suggest for you to [open an issue](https://github.com/elastic/kibana/issues/new?assignees=&labels=bug&template=Bug_report.md) in the Kibana tracker. Please add a link to this discussion, but without a reproducible scenario for the developers I'm unsure how much we can help.

---

<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:** [November 29, 2022, 2:27pm UTC](https://discuss.elastic.co/t/error-when-exporting-more-than-1000-saved-objects/317497/9 "2022-11-29T14:27:23Z")

</div>



---

<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:** [December 27, 2022, 2:27pm UTC](https://discuss.elastic.co/t/error-when-exporting-more-than-1000-saved-objects/317497/10 "2022-12-27T14:27:55Z")

</div>

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