I'm completely new here so, first off, I apologize if I do things the wrong way. I'd like to learn the right way as we are just beginning our road with Elastic Search.
In troubleshooting why a document is not being returned from a search, I'm attempting to set up a quick test script to check the tokens the analyzer would have set for a document field (I understand I cannot actually retrieve the tokens directly).
I'm getting this error:
'{"error":{"root_cause":[{"type":"parse_exception","reason":"request body or source parameter is required"}],"type":"parse_exception","reason":"request body or source parameter is required"},"status":400}'
The code seems very simple:
es.get({
index: 'admin_objects',
id: '87053',
type: 'object'
}, function(err, resp, status) {
if (err) {
console.log(err);
} else {
console.log(resp);
let source = resp._source;
let words = source.words;
es.indices.analyze({
'analyzer' : 'standard',
'text' : words
}, function(err, resp, status) {
if (err) {
console.log(err);
} else {
console.log(resp);
}
});
}
});
I've followed examples I've seen, including this one for .analyze():
https://www.elastic.co/guide/en/elasticsearch/reference/6.8/indices-analyze.html
I've tried supplying the rep object, the _source object, the field (words) directly but I'm getting different error messages w/ everything I try.
Hmmmm...