# Getting error when i try to import the Json file

**URL:** <https://discuss.elastic.co/t/getting-error-when-i-try-to-import-the-json-file/67676>\
**Category:** Elasticsearch\
**Created:** [November 30, 2016, 8:43pm UTC](https://discuss.elastic.co/t/getting-error-when-i-try-to-import-the-json-file/67676 "2016-11-30T20:43:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![raki1205](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@raki1205](https://discuss.elastic.co/u/raki1205)\
**Post date:** [November 30, 2016, 8:43pm UTC](https://discuss.elastic.co/t/getting-error-when-i-try-to-import-the-json-file/67676/1 "2016-11-30T20:43:22Z")

</div>

Hi,  
I'm new to elastic search. When i try to load a json file using CURl, I'm getting an error

**ERROR**  
$ curl -XPUT xxxxxxxxxx:9200/\_bulk --data-binary @FSAudit.log-2016-11-30-001.part.json  
{"error":{"root\_cause":[{"type":"illegal\_argument\_exception","reason":"Action/metadata line [1] contains an unknown parameter [$date]"}],"type":"illegal\_argument\_exception","reason":"Action/metadata line [1] contains an unknown parameter [$date]"},"status":400}

While the Index is getting created properly. Index i created is below.

**INDEX**  
curl -XPUT [http://xxxxxxxxx:9200/fsaudit](http://xxxxxxxxx:9200/fsaudit) -d '  
{  
"mappings" : {  
"_default_" : {  
"properties" : {  
"@timestamp" : { "type" : "date" },  
"timestamp":{"properties":{"$date":{"type":"date","format":"strict\_date\_optional\_time||

epoch\_millis"}}},  
"operation" : {"type": "string" },  
"user" : { "type" : "string" },  
"uid" : { "type" : "integer" },  
"ipAddress" : { "type" : "string" },  
"nfsServer" : { "type" : "string" },  
"parentPath" : { "type" : "string" },  
"parentFid" : { "type" : "string" },  
"childPath" : { "type" : "string" },  
"childFid" : { "type" : "string" },  
"childName" : { "type" : "string" },  
"VolumeName" : { "type" : "string" },  
"volumeId" : { "type" : "integer" },  
"status" : { "type" : "integer" }  
}  
}  
}  
}  
';

Please help us in rectifying the issue.

Thanks,  
Rakesh

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [December 1, 2016, 11:34am UTC](https://discuss.elastic.co/t/getting-error-when-i-try-to-import-the-json-file/67676/2 "2016-12-01T11:34:54Z")

</div>

We need to see line 1 of the FSAudit.log-2016-11-30-001.part.json file

---

<div class="post-metadata">

**Author:** ![raki1205](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@raki1205](https://discuss.elastic.co/u/raki1205)\
**Post date:** [December 1, 2016, 4:11pm UTC](https://discuss.elastic.co/t/getting-error-when-i-try-to-import-the-json-file/67676/3 "2016-12-01T16:11:09Z")

</div>

Hi Mark,

Below is my few contents of the Json file.

{"timestamp":{"$date":"2016-11-30T06:00:33.362Z"},"operation":"ENABLEAUDIT","user":"mapr","uid":5000,"ipAddress":"x.x.x.x","srcPath":"/audit/myaudit/","srcFid":"9155.16.2","VolumeN  
ame":"myaudit","volumeId":181245567,"status":0}  
{"timestamp":{"$date":"2016-11-30T06:05:31.223Z"},"operation":"MKDIR","user":"root","uid":0,"ipAddress":"127.0.0.1","nfsServer":"x.x.x.x","parentPath":"/audit/myaudit/","parentFid"  
:"9155.16.2","childPath":"/audit/myaudit/testdir","childFid":"9155.32.131394","childName":"testdir","VolumeName":"myaudit","volumeId":181245567,"status":0}

Thanks in Advance..

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [December 1, 2016, 4:14pm UTC](https://discuss.elastic.co/t/getting-error-when-i-try-to-import-the-json-file/67676/4 "2016-12-01T16:14:01Z")

</div>

Wrong format?  
This looks to be all data, and no actions - see [https://www.elastic.co/guide/en/elasticsearch/reference/5.0/docs-bulk.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/docs-bulk.html)

---

<div class="post-metadata">

**Author:** ![raki1205](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@raki1205](https://discuss.elastic.co/u/raki1205)\
**Post date:** [December 1, 2016, 4:54pm UTC](https://discuss.elastic.co/t/getting-error-when-i-try-to-import-the-json-file/67676/5 "2016-12-01T16:54:49Z")

</div>

Mark,

But I'm getting the error for the date .Is it something to do with the data?

Thanks

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [December 1, 2016, 4:58pm UTC](https://discuss.elastic.co/t/getting-error-when-i-try-to-import-the-json-file/67676/6 "2016-12-01T16:58:06Z")

</div>

Yes. "Date" is not an action - it's data.  
A bulk file is:

```
action
data

action
data

action
data

```

Actions are either index, delete or update commands so you need to prefix each data doc with an action instruction. The document I linked to describes this format.

---

<div class="post-metadata">

**Author:** ![raki1205](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@raki1205](https://discuss.elastic.co/u/raki1205)\
**Post date:** [December 2, 2016, 6:31pm UTC](https://discuss.elastic.co/t/getting-error-when-i-try-to-import-the-json-file/67676/7 "2016-12-02T18:31:06Z")

</div>

Thanks Mark..It worked

---

<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 30, 2016, 6:31pm UTC](https://discuss.elastic.co/t/getting-error-when-i-try-to-import-the-json-file/67676/8 "2016-12-30T18:31:10Z")

</div>

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