Analyze API in NodeJS

I added html_strip ad analyzer in the settings of an index.
const esObject = {
analyzer: 'html_analyzer',
text: ' This is Bold ,
};

So as per documentation this work in my Kibana Console but I want to use GET _index/_analyze in NODE.js

Can I use elasticSearchNodeClient.indices.analyze(esObject);

Please ask me if you need more detail.

Hi @tirth_pipalia,

As per the JavaScript client docs, client.indices.analyze(...) is the corresponding call for the _analyze API. So it sounds like what you need.

Hope that helps!

1 Like

Thank you @carly.richmond for the response. I'm using that same function but then it sends some parse_exception.


image

Just a heads up for next time that it's easier to read errors if you use the code snippet to format the text instead of a screenshot.

The error is a malformed body, so the request isn't in the right format. One thing that doesn't look right to me is you aren't specifying an index attribute with your analyzer request. Could that be the problem?

1 Like

Thank you @carly.richmond for solving my issue. I was just passing the body not the index field along with it.

1 Like

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