# Error saying request body or source is required

**URL:** <https://discuss.elastic.co/t/error-saying-request-body-or-source-is-required/147523>\
**Category:** Elasticsearch\
**Created:** [September 6, 2018, 7:55am UTC](https://discuss.elastic.co/t/error-saying-request-body-or-source-is-required/147523 "2018-09-06T07:55:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chitresh\_jain](https://avatars.discourse-cdn.com/v4/letter/c/46a35a/32.png) [@chitresh\_jain](https://discuss.elastic.co/u/chitresh_jain)\
**Post date:** [September 6, 2018, 7:55am UTC](https://discuss.elastic.co/t/error-saying-request-body-or-source-is-required/147523/1 "2018-09-06T07:55:42Z")

</div>

So I am testing my analyzer after I created it successfully using -  
{  
"settings" : {  
"analysis": {  
"filter": {  
"autocomplete\_filter" : {  
"type" : "edge\_ngram",  
"min\_gram" : 1,  
"max\_gram" : 20  
}  
},  
"analyzer": {  
"autocomplete" : {  
"type" : "custom",  
"tokenizer" : "standard",  
"filter" : [  
"lowercase",  
"autocomplete\_filter"  
]  
}  
}  
}  
}  
}

After this I indexed the data in my index named "assessment\_kit"

But When I am testing it using - curl -XGET "localhost:9200/assessment\_kit/\_analyze?analyzer=autocomplete&pretty" -H -d "Fro"

I am getting an 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  
}  
curl: (6) Could not resolve host: Fro

I should be able to get ngram for the same?

---

<div class="post-metadata">

**Author:** ![abdon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdon/32/9195_2.png) [@abdon](https://discuss.elastic.co/u/abdon)\
**Post date:** [September 7, 2018, 8:06am UTC](https://discuss.elastic.co/t/error-saying-request-body-or-source-is-required/147523/2 "2018-09-07T08:06:50Z")

</div>

Your curl request is malformed. Try the following:

```auto
curl -XGET "http://localhost:9200/assessment_kit/_analyze?pretty" -H 'Content-Type: application/json' -d '{ "analyzer": "autocomplete", "text": "Fro" }'

```

---

<div class="post-metadata">

**Author:** ![Sachin\_Agarwal](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@Sachin\_Agarwal](https://discuss.elastic.co/u/Sachin_Agarwal)\
**Post date:** [September 18, 2018, 12:50pm UTC](https://discuss.elastic.co/t/error-saying-request-body-or-source-is-required/147523/3 "2018-09-18T12:50:52Z")

</div>

Somehow I have similar issue with getting the \_analyze endpoint to work: See the example below, and the silent failure at the end (no output for the last command)

```auto
$~/code/esapp$ GET http://localhost:9200/awscatalog-ngram/_settings?pretty
{
  "awscatalog-ngram" : {
    "settings" : {
      "index" : {
        "number_of_shards" : "5",
        "provided_name" : "awscatalog-ngram",
        "creation_date" : "1537273886758",
        "analysis" : {
          "analyzer" : {
            "an_analyzer" : {
              "filter" : [
                "lowercase"
              ],
              "type" : "custom",
              "tokenizer" : "a_tokenizer"
            }
          },
          "tokenizer" : {
            "a_tokenizer" : {
              "token_chars" : [
                "letter",
                "digit"
              ],
              "min_gram" : "2",
              "type" : "edge_ngram",
              "max_gram" : "10"
            }
          }
        },
        "number_of_replicas" : "1",
        "uuid" : "U8UmxEIMSK659Bfa7n_k1g",
        "version" : {
          "created" : "6040099"
        }
      }
    }
  }
}
$~/code/esapp$ GET http://localhost:9200/awscatalog-ngram/_analyze?pretty -H 'Content-Type: application/json' -d '{ "analyzer": "an_analyzer", "text": "velociraptors are cool" }'
 $~/code/esapp$ 

```

What am I doing wrong?

Thanks in advance.

---

<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:** [October 16, 2018, 12:50pm UTC](https://discuss.elastic.co/t/error-saying-request-body-or-source-is-required/147523/4 "2018-10-16T12:50:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [December 2, 2021, 5:27pm UTC](https://discuss.elastic.co/t/error-saying-request-body-or-source-is-required/147523/5 "2021-12-02T17:27:20Z")

</div>

Hi, the problem could be in this test command:

```auto
curl -XGET http://localhost:9200/awscatalog-ngram/_analyze?pretty -H 'Content-Type: application/json' -d '{ "analyzer": "an_analyzer", "text": "velociraptors are cool" }'

```

This sends a request that has a body payload, so it should use the POST method.
