# Import Data via Machine Learning - Data not sent

**URL:** <https://discuss.elastic.co/t/import-data-via-machine-learning-data-not-sent/242900>\
**Category:** Kibana\
**Tags:** elastic-stack-machine-learning\
**Created:** [July 28, 2020, 12:20pm UTC](https://discuss.elastic.co/t/import-data-via-machine-learning-data-not-sent/242900 "2020-07-28T12:20:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![aducSG](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@aducSG](https://discuss.elastic.co/u/aducSG)\
**Post date:** [July 28, 2020, 12:20pm UTC](https://discuss.elastic.co/t/import-data-via-machine-learning-data-not-sent/242900/1 "2020-07-28T12:20:48Z")

</div>

Hello,  
I have been using the experimental feature to import Data from a CSV file (in Machine Learning \> Import Data).  
The import is working perfectly fine, all the documents are imported in a new index.

However, when I tried to send new documents through my usual way, it's not working for the new index (even for other new ones, created the same way). But if I use the original index, it still works.

Is the issue linked to the way I created the index ? or am I missing some configurations ?  
FYI, I am using ajax call to send data to Elasticsearch, calling the url directly: '[http://servername/els/Index/\_doc/](http://servername/els/Index/_doc/)'

---

<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:** [July 29, 2020, 8:30am UTC](https://discuss.elastic.co/t/import-data-via-machine-learning-data-not-sent/242900/2 "2020-07-29T08:30:02Z")

</div>

> when I tried to send new documents through my usual way

Are these new documents in CSV format? If they are then it makes a big difference which version of Elasticsearch you are using, as we completely changed the way the ML file import handles CSV in 7.7.

> it's not working

What error message do you get?

Please give an example of the document you're trying to add to the index, and also the [mappings](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-mapping.html) of the index you're trying to add to.

---

<div class="post-metadata">

**Author:** ![aducSG](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@aducSG](https://discuss.elastic.co/u/aducSG)\
**Post date:** [July 29, 2020, 1:53pm UTC](https://discuss.elastic.co/t/import-data-via-machine-learning-data-not-sent/242900/3 "2020-07-29T13:53:08Z")

</div>

Hello droberts195,  
Thank you for answering.

I am in version 7.4 for both Kibana and Elastisearch.  
The new documents sent are not in CSV format; they are sent using the regular way of monitoring data, that I used before to implement the index (ajax call).

I don't have a lot of details in the error message:

```auto
{"ts":"15:48:10.819","ctx":"Action","action":"ctx.log","params":[" ctx.ajax.call error: ",0],"verb":"LOGMESS","parentId":279}
	ts: '15:48:10.819'
	ctx: 'Action'
	action: 'ctx.log'
	params: 
		[0]: ' ctx.ajax.call error: '
		[1]: 0
	verb: 'LOGMESS'
	parentId: 279

```

And here is an example of document:

```auto
     {
        "_index" : "import",
        "_type" : "_doc",
        "_id" : "yqjRgHMBHmE512Ofb9cj",
        "_score" : 1.0,
        "_source" : {
          "RPA" : "PSC_IMPAYES",
          "dateStart" : "2020-02-06 15:08:44.354",
          "dateStop" : "2020-02-06 15:10:36.762",
          "duration" : "112",
          "error" : "Step GLOBAL.scStep1_CollectDataScenario_Contact.stContactNavigateToConnaissanceClientInterlocuteur: Error, CONTACT.pConnaissanceInterlocuteur.execScript: Argument ou appel de procédure incorrect",
          "scenario" : "Etape 1 : scStep1_CollectDataScenario",
          "stopAuto" : "YES",
          "user" : "A242135",
          "version" : "1.0.1",
          "volume" : 1
        }

```

For the mapping:

```auto
{
  "mapping": {
    "_meta": {
      "created_by": "ml-file-data-visualizer"
    },
    "properties": {
      "RPA": {
        "type": "keyword"
      },
      "anomalie": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "checkpoint": {
        "type": "keyword"
      },
      "dateStart": {
        "type": "date",
        "format": "yyyy-MM-dd HH:mm:ss.SSS||yyyy-MM-dd HH:mm:ss.SS||yyyy-MM-dd HH:mm:ss.S"
      },
      "dateStop": {
        "type": "date",
        "format": "yyyy-MM-dd HH:mm:ss.SSS||yyyy-MM-dd HH:mm:ss.SS||yyyy-MM-dd HH:mm:ss.S"
      },
      "duration": {
        "type": "keyword"
      },
      "error": {
        "type": "text"
      },
      "scenario": {
        "type": "text"
      },
      "script_source": {
        "type": "text"
      },
      "stopAuto": {
        "type": "keyword"
      },
      "stopUser": {
        "type": "keyword"
      },
      "timeout": {
        "type": "keyword"
      },
      "user": {
        "type": "keyword"
      },
      "version": {
        "type": "keyword"
      },
      "volume": {
        "type": "long"
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![aducSG](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@aducSG](https://discuss.elastic.co/u/aducSG)\
**Post date:** [August 12, 2020, 8:05am UTC](https://discuss.elastic.co/t/import-data-via-machine-learning-data-not-sent/242900/4 "2020-08-12T08:05:34Z")

</div>

Could anyone help me please ?

---

<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:** [August 12, 2020, 8:30am UTC](https://discuss.elastic.co/t/import-data-via-machine-learning-data-not-sent/242900/5 "2020-08-12T08:30:37Z")

</div>

I cannot see anything wrong with the mappings.

I think the next step is to try indexing one of your new documents to the index that was created by the file uploader using `curl` instead of your ajax framework. For example:

```auto
curl -X POST "https://<es-host>:9200/import/_doc?pretty" -H 'Content-Type: application/json' -d '
{
          "RPA" : "PSC_IMPAYES",
          "dateStart" : "2020-02-06 15:08:44.354",
          "dateStop" : "2020-02-06 15:10:36.762",
          "duration" : "112",
          "error" : "Step GLOBAL.scStep1_CollectDataScenario_Contact.stContactNavigateToConnaissanceClientInterlocuteur: Error, CONTACT.pConnaissanceInterlocuteur.execScript: Argument ou appel de procédure incorrect",
          "scenario" : "Etape 1 : scStep1_CollectDataScenario",
          "stopAuto" : "YES",
          "user" : "A242135",
          "version" : "1.0.1",
          "volume" : 1
}
'

```

You'll need a `-u username:password` in the arguments too if you have security enabled.

This will show the underlying error from Elasticsearch.

---

<div class="post-metadata">

**Author:** ![aducSG](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@aducSG](https://discuss.elastic.co/u/aducSG)\
**Post date:** [August 12, 2020, 8:45am UTC](https://discuss.elastic.co/t/import-data-via-machine-learning-data-not-sent/242900/6 "2020-08-12T08:45:20Z")

</div>

Thank you for your answer, I will try that then.

---

<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 9, 2020, 8:45am UTC](https://discuss.elastic.co/t/import-data-via-machine-learning-data-not-sent/242900/7 "2020-09-09T08:45:47Z")

</div>

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