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


(radhe) #1

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"
index => "somki"
user => elastic
password => "elastic"
}
stdout { codec => rubydebug }
}

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


(radhe) #2

Please, anyone?


(radhe) #3

Someone?


(Christian Dahlqvist) #4

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


(radhe) #5

fair enough.


(system) #6

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