Not Able to search data from the ingested PDF

I am using nodejs client (elasticsearch.js) .

I have ingested a PDF into elasticsearch using mapper attachment plugin. .The ingestion was successful. Whenever i am trying to search data from the document (already ingested), nothing is returned.

Here is my code sample:

var fs = require('fs');
var content = fs.readFileSync('DATA', 'utf8');

var base64 = new Buffer(content).toString('base64');

client.create({
    index: 'files',
    type: 'document',
    body: {
        file_id: '1',
        file: {
            _content: base64
        }
    }
})
.catch((err) => {
    console.error('Error while creating elasticsearch record', err);
});

search.js

client.search({
    index: 'files',
    type: 'document',
    body: {
        query: {
            match: {
                message: "makes it easy and affordable"
            }
         }
    }
}, function(error, resp, status){
    console.log("----SEARCH----");
    if (error) {
        console.log(error);
    }
    console.log(JSON.stringify(resp) + "  :   SEARCH");
    console.log(status);
});

The search.js returns

----SEARCH----
{"took":1,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":0,"max_score":nu
ll,"hits":[]}}  :   SEARCH
200

I am a newbie with elastic, can someone guide me to what am i missing here

Mapper attachments plugin has been removed now. Please use ingest attachment processor instead.

See https://www.elastic.co/guide/en/elasticsearch/plugins/6.3/ingest-attachment.html

I tried with ingest attachment too, but still getting the same result, is there any error with the query if you can check @dadoonet

What does look like a document you have indexed with ingest-attachment?

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