# Analyze API in NodeJS

**URL:** <https://discuss.elastic.co/t/analyze-api-in-nodejs/327666>\
**Category:** Elasticsearch\
**Created:** [March 14, 2023, 1:04pm UTC](https://discuss.elastic.co/t/analyze-api-in-nodejs/327666 "2023-03-14T13:04:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tirth\_pipalia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tirth_pipalia/32/98118_2.png) [@tirth\_pipalia](https://discuss.elastic.co/u/tirth_pipalia)\
**Post date:** [March 14, 2023, 1:04pm UTC](https://discuss.elastic.co/t/analyze-api-in-nodejs/327666/1 "2023-03-14T13:04:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [March 15, 2023, 11:24am UTC](https://discuss.elastic.co/t/analyze-api-in-nodejs/327666/2 "2023-03-15T11:24:32Z")

</div>

Hi @tirth_pipalia,

As per the [JavaScript client docs](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html), `client.indices.analyze(...)` is the corresponding call for the `_analyze` API. So it sounds like what you need.

Hope that helps!

---

<div class="post-metadata">

**Author:** ![tirth\_pipalia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tirth_pipalia/32/98118_2.png) [@tirth\_pipalia](https://discuss.elastic.co/u/tirth_pipalia)\
**Post date:** [March 15, 2023, 12:56pm UTC](https://discuss.elastic.co/t/analyze-api-in-nodejs/327666/3 "2023-03-15T12:56:23Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac78530d1aecc8d5f1d69154dcc2efb1894a684.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/a/2a0708f6a2fd6d0c789f89f5a36650705c8f4420.png)

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [March 15, 2023, 6:31pm UTC](https://discuss.elastic.co/t/analyze-api-in-nodejs/327666/4 "2023-03-15T18:31:41Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![tirth\_pipalia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tirth_pipalia/32/98118_2.png) [@tirth\_pipalia](https://discuss.elastic.co/u/tirth_pipalia)\
**Post date:** [March 16, 2023, 3:07pm UTC](https://discuss.elastic.co/t/analyze-api-in-nodejs/327666/5 "2023-03-16T15:07:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 13, 2023, 3:07pm UTC](https://discuss.elastic.co/t/analyze-api-in-nodejs/327666/6 "2023-04-13T15:07:56Z")

</div>

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