# Fetching Tokens Created by Analyzer?

**URL:** <https://discuss.elastic.co/t/fetching-tokens-created-by-analyzer/234627>\
**Category:** Elasticsearch\
**Created:** [May 27, 2020, 10:36pm UTC](https://discuss.elastic.co/t/fetching-tokens-created-by-analyzer/234627 "2020-05-27T22:36:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicowens](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@nicowens](https://discuss.elastic.co/u/nicowens)\
**Post date:** [May 27, 2020, 10:36pm UTC](https://discuss.elastic.co/t/fetching-tokens-created-by-analyzer/234627/1 "2020-05-27T22:36:00Z")

</div>

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:

```auto

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](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...

---

<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:** [June 24, 2020, 10:36pm UTC](https://discuss.elastic.co/t/fetching-tokens-created-by-analyzer/234627/2 "2020-06-24T22:36:09Z")

</div>

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