# Could not import file csv from Kibana or Logstash to Elasticsearch

**URL:** <https://discuss.elastic.co/t/could-not-import-file-csv-from-kibana-or-logstash-to-elasticsearch/224817>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-machine-learning\
**Created:** [March 24, 2020, 11:29am UTC](https://discuss.elastic.co/t/could-not-import-file-csv-from-kibana-or-logstash-to-elasticsearch/224817 "2020-03-24T11:29:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hanguyen.uet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hanguyen.uet/32/71151_2.png) [@hanguyen.uet](https://discuss.elastic.co/u/hanguyen.uet)\
**Post date:** [March 24, 2020, 11:29am UTC](https://discuss.elastic.co/t/could-not-import-file-csv-from-kibana-or-logstash-to-elasticsearch/224817/1 "2020-03-24T11:29:51Z")

</div>

Hi everybody!  
When I imported the csv file with 1000 records, everything was fine.  
But with 100,000 records, the error: **"File could not be read. Unexpected token \< in JSON at position 0"**. Can someone help me?  
Thank you so much ^^.

 ![Capture](https://us1.discourse-cdn.com/elastic/original/3X/0/f/0f9e508e58b707b9d4675988b6989f7415aa9a1e.png)

---

<div class="post-metadata">

**Author:** ![droberts195](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/droberts195/32/17692_2.png) [@droberts195](https://discuss.elastic.co/u/droberts195)\
**Post date:** [March 24, 2020, 11:53am UTC](https://discuss.elastic.co/t/could-not-import-file-csv-from-kibana-or-logstash-to-elasticsearch/224817/2 "2020-03-24T11:53:46Z")

</div>

Please could you try sending your CSV file directly to the [Elasticsearch find file structure endpoint](https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-find-file-structure.html), adding the `explain` URL argument. So something like this, replacing `localhost:9200` with the correct host and port for your Elasticsearch:

```auto
curl -u user:password -s -H "Content-Type: application/json" -X POST "localhost:9200/_ml/find_file_structure?pretty&explain" -T my_csv_file.csv > response.txt

```

(Yes I know the `Content-Type: application/json` is inconsistent with it being a CSV file, but that is not the cause of your problem. All requests have to claim to be JSON.)

At the bottom of the large response is the `explanation` section. Please redact any confidential information that is in it and then paste the `explanation` section into this post. Hopefully that will give a clue about what happened.

Also, which version are you using?

---

<div class="post-metadata">

**Author:** ![hanguyen.uet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hanguyen.uet/32/71151_2.png) [@hanguyen.uet](https://discuss.elastic.co/u/hanguyen.uet)\
**Post date:** [March 25, 2020, 3:34am UTC](https://discuss.elastic.co/t/could-not-import-file-csv-from-kibana-or-logstash-to-elasticsearch/224817/3 "2020-03-25T03:34:01Z")

</div>

Hi David!  
Thank you for reply. But problem in my Nginx config and I solved it.  
Best regards.

---

<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:** [April 22, 2020, 3:34am UTC](https://discuss.elastic.co/t/could-not-import-file-csv-from-kibana-or-logstash-to-elasticsearch/224817/4 "2020-04-22T03:34:10Z")

</div>

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