1

I installed an Elastic Search Server (ES server), version 7.16.3, and I can't use (or play with) the analyse API mentioned here :

Test an analyser

I've got the response:

{
    "error": "Incorrect HTTP method for uri [/_analyse] and method [POST], allowed: [HEAD, PUT, GET, DELETE]",
    "status": 405
}

with their first request :

POST _analyze
{
  "analyzer": "whitespace",
  "text":     "The quick brown fox."
}

How do I make their example working on my local ES server ?

Amit
  • 30,756
  • 6
  • 57
  • 88
François F.
  • 229
  • 2
  • 17

1 Answers1

0

Correct endpoint for analyze API is localhost:9200/_analyze not localhost:9200/_analyse, and you are using the wrong name in the endpoint which is causing the issue.

enter image description here

Amit
  • 30,756
  • 6
  • 57
  • 88
  • Your doc is wrong version. If using GET I've got response : { "error": { "root_cause": [ { "type": "illegal_argument_exception", "reason": "request [GET /_analyse] does not support having a body" } ], "type": "illegal_argument_exception", "reason": "request [GET /_analyse] does not support having a body" }, "status": 400 } – François F. Apr 22 '22 at 08:56
  • @FrançoisF., what do you mean by doc is wrong version? – Amit Apr 22 '22 at 08:57
  • @FrançoisF., i've always used both GET and POST API for `analyze` as asked earlier which tool you are using to make this call? – Amit Apr 22 '22 at 08:58
  • My version is not the latest, it is version 7.16.3, so the doc should be (cf. my link) – François F. Apr 22 '22 at 08:58
  • I use postman, make a POST request with : {{elserver}}/_analyse – François F. Apr 22 '22 at 08:59
  • `_analyze` is the correct name, can you change yours `_analyse` to it? – Amit Apr 22 '22 at 09:00
  • I don't understand, here my whole request URL used : http://localhost:9200/_analyse – François F. Apr 22 '22 at 09:02
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/244101/discussion-between-amit-and-francois-f). – Amit Apr 22 '22 at 09:03
  • Ok thanks _analyZe and not _analySe – François F. Apr 22 '22 at 09:15