在csv文件csv-river插件中处理逗号

时间:2014-04-08 15:31:10

标签: indexing elasticsearch

我正在尝试将csv文件中的数据索引到elasticsearch服务器。问题是字符串本身包含多个","因此在索引期间,它会给出indexoutofbound异常。

如何使用csv-river plugin来处理逗号。

编辑:

示例文件为:

MESSAGE_ID,PARENT_MESSAGE_ID,THREAD_ID,FORUM_ID,FORUMINDEX,USER_ID,SUBJECT,BODY,MODVALUE,FORUM_NAME,CATEGORY_NAME,LIKES,DISLIKES,IS_ROOT_MESSAGE,IS_QUESTION
244,195,103,4,3,341,Re: The most stupidest program I've ever seen--Amazon,"I know nothing of your case, but I do know that throwing around terms like ""stupid idiot"" doesn't exactly help your side any.",1,"Order Management, Shipping, Feedback & Returns",Sell on Amazon,,,no,no

1 个答案:

答案 0 :(得分:0)

您需要将字段括在引号中。如果该字段包含引号,则需要使用前面的引号将其转义。 例如:

"field1","field2","field3 with, commas","field4","field ""5"" with quotes","field6"