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