# Why can't I upload index from csv file directly in required format?

**URL:** <https://discuss.elastic.co/t/why-cant-i-upload-index-from-csv-file-directly-in-required-format/136444>\
**Category:** Elasticsearch\
**Created:** [June 19, 2018, 8:21am UTC](https://discuss.elastic.co/t/why-cant-i-upload-index-from-csv-file-directly-in-required-format/136444 "2018-06-19T08:21:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rs123](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@rs123](https://discuss.elastic.co/u/rs123)\
**Post date:** [June 19, 2018, 8:21am UTC](https://discuss.elastic.co/t/why-cant-i-upload-index-from-csv-file-directly-in-required-format/136444/1 "2018-06-19T08:21:12Z")

</div>

I have a csv file which contains four columns(oNumber, oName, userids, userID) and value of first two columns I want to put in input and value of remaining two column's value I want to put in userid.  
Mapping:

> PUT somki  
> {  
> "mappings": {  
> "\_doc" : {  
> "properties" : {  
> "suggest" : {  
> "type" : "completion",  
> "contexts": [  
> {  
> "name": "userid",  
> "type": "category"  
> }  
> ]  
> }  
> }  
> }  
> }  
> }

Indexing:

> POST somki/\_doc/  
> {  
> "suggest": {  
> "input": ["123","asb"],  
> "contexts": {  
> "userid": ["99568656541578","abhi"]  
> }  
> }  
> }

Suggester:

> GET somki/\_search  
> {  
> "suggest": {  
> "suggestion" : {  
> "prefix" : "asb",  
> "completion" : {  
> "field" : "suggest",  
> "contexts": {  
> "userid": ["99568656541578"]  
> },  
> "fuzzy" : {  
> "fuzziness" : 2  
> }  
> }  
> }  
> }  
> }

This method works well but I have to index data manually for every row. So I want to use logstash and here is my .conf file

> input {
> 
> file {  
> path =\> "C:\Users\ramesh\Downloads\elasticsearch\Data\Book1.csv"  
> start\_position =\> "beginning"  
> sincedb\_path =\> "/dev/null"  
> }
> 
> generator {  
> lines =\> ['oNumber,oName,userids,userID']  
> count =\> 1  
> }  
> }
> 
> filter {  
> grok {  
> match =\> { "message" =\> "%{NOTSPACE:[suggest][input]},%{NOTSPACE:[suggest][input]},%{NOTSPACE:[suggest][contexts][userid]},%{NOTSPACE:[suggest][contexts][userid]}" }  
> }  
> }
> 
> output {  
> elasticsearch {  
> hosts =\> "[http://localhost:9200](http://localhost:9200)"  
> index =\> "somki"  
> user =\> elastic  
> password =\> "elastic"  
> }  
> stdout { codec =\> rubydebug }  
> }

But suggester is not showing any output, Why? And how to solve it.

---

<div class="post-metadata">

**Author:** ![rs123](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@rs123](https://discuss.elastic.co/u/rs123)\
**Post date:** [June 20, 2018, 7:27am UTC](https://discuss.elastic.co/t/why-cant-i-upload-index-from-csv-file-directly-in-required-format/136444/2 "2018-06-20T07:27:28Z")

</div>

Please, anyone?

---

<div class="post-metadata">

**Author:** ![rs123](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@rs123](https://discuss.elastic.co/u/rs123)\
**Post date:** [June 21, 2018, 5:23am UTC](https://discuss.elastic.co/t/why-cant-i-upload-index-from-csv-file-directly-in-required-format/136444/3 "2018-06-21T05:23:12Z")

</div>

Someone?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 21, 2018, 5:29am UTC](https://discuss.elastic.co/t/why-cant-i-upload-index-from-csv-file-directly-in-required-format/136444/4 "2018-06-21T05:29:24Z")

</div>

Your title does not seem to match the current problem, so it is possible the issue is not getting attention from the right people.

---

<div class="post-metadata">

**Author:** ![rs123](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@rs123](https://discuss.elastic.co/u/rs123)\
**Post date:** [June 21, 2018, 6:26am UTC](https://discuss.elastic.co/t/why-cant-i-upload-index-from-csv-file-directly-in-required-format/136444/5 "2018-06-21T06:26:39Z")

</div>

fair enough.

---

<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:** [July 19, 2018, 6:26am UTC](https://discuss.elastic.co/t/why-cant-i-upload-index-from-csv-file-directly-in-required-format/136444/6 "2018-07-19T06:26:41Z")

</div>

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