Mapper-attachments-2.3.3 MapperParsingException[No content is provided.]

Hello everyone,

I have an error I don't succeed to solve...

I put a mapping file that looks like this :
{
"article" : {
"properties" : {
"title" : {"type" : "string"},
"articleId" : {"type" : "string"},
"articleStatus" : {"type" : "string", "index" : "not_analyzed"},
"url" : {"type" : "string", "index" : "not_analyzed"},
"serviceLine" : {"type" : "string"},
"servicePackage" : {"type" : "string"},
"applicationName" : {"type" : "string"},
"articleType" : {"type" : "string", "index" : "not_analyzed"},
"level" : {"type" : "integer"},
"updateDate" : {"type" : "string", "index" : "not_analyzed"},
"version" : {"type" : "string", "index" : "not_analyzed"},
"file": {
"type": "attachment",
"fields": {
"content" : { "store" : "yes" },
"author" : { "store" : "yes" },
"title" : { "store" : "yes", "analyzer" : "english"},
"date" : { "store" : "yes" },
"keywords" : { "store" : "yes", "analyzer" : "keyword" },
"name" : { "store" : "yes" },
"content_type" : { "store" : "yes"},
"content_length" : { "store" : "yes"}
}
}
}
}
}

And when I try to index an article that looks like this :
{
"title" : "Can I fill in free text in the resolution tags?- Semaphore",
"articleId" : "121067",
"articleStatus" : "Published",
"url" : "C:\Users\NG5F7F2\tests\[selfservice]-TESTTOINSERT.html",
"serviceLine" : "IN_Workplace",
"servicePackage" : "Service Desk",
"applicationName" : "SEMAPHORE -REMEDY SUPPORT",
"articleType" : "How Do I",
"level" : 1,
"updateDate" : "2016-09-07T11:57:21",
"version" : "1.0",
"file" : {
"title":"Can I fill in free text in the resolution tags?- Semaphore",
"author":"System Account",
"name":"can-i-fill-in-free-text-in-the-resolution-tags--semaphore.html",
"content_type":"text/html",
"date":"2016-09-07T11:57:21",
"content":"Z2dnZ2dnZ2dnZ2dnZ2dnZ2c=",
"keywords":"SeMaPHORE, MARS, Incident, Problem, Change, Asset, Remedy, BMC",
"content_length":"1213"
}
}

I get this error :
MapperParsingException[No content is provided.]
at org.elasticsearch.mapper.attachments.AttachmentMapper.parse(AttachmentMapper.java:468)
at org.elasticsearch.index.mapper.DocumentParser.parseObjectOrField(DocumentParser.java:309)
at org.elasticsearch.index.mapper.DocumentParser.parseObject(DocumentParser.java:326)
at org.elasticsearch.index.mapper.DocumentParser.parseObject(DocumentParser.java:252)
at org.elasticsearch.index.mapper.DocumentParser.parseDocument(DocumentParser.java:122)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:309)
at org.elasticsearch.index.shard.IndexShard.prepareIndex(IndexShard.java:580)
at org.elasticsearch.index.shard.IndexShard.prepareIndexOnPrimary(IndexShard.java:559)
at org.elasticsearch.action.index.TransportIndexAction.prepareIndexOperationOnPrimary(TransportIndexAction.java:212)
at org.elasticsearch.action.index.TransportIndexAction.executeIndexRequestOnPrimary(TransportIndexAction.java:224)
at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:158)
at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:66)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryPhase.doRun(TransportReplicationAction.java:639)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived(TransportReplicationAction.java:279)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived(TransportReplicationAction.java:271)
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:75)
at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:376)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Please help ! I really don't get where I'm wrong

I use elasticsearch 2.3.3 and the mapper-attachments with the same version

Thank you

Anne-Sophie

Hello Anne-Sophie

Please format your code using </> icon. It will make your post more readable.

As you can read in the guide, you have to put your documents like this:

PUT /test/article/1
{
    "file" : "... base64 encoded attachment ..."
}

Or like this:

PUT /test/article/1
{
    "file" : {
        "_content_type" : "text/html",
        "_name" : "can-i-fill-in-free-text-in-the-resolution-tags--semaphore.html",
        "_content" : "... base64 encoded attachment ..."
    }
}

Hope this helps

Ho I didn't end up on this usage page of the mapper-attachments plugin...
Just forgot the _ before some fields names...

Thank you SO MUCH

Best