elastic / elasticsearch

Free and Open Source, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
878 stars 24.81k forks source link

Incorrect HTTP method (405) for _field_usage_stats #90023

Closed omrikurtz closed 2 years ago

omrikurtz commented 2 years ago

Elasticsearch Version

7.17

Installed Plugins

x-pack, searchguard

Java Version

11.0.5

OS Version

Linux (Ubuntu 18)

Problem Description

We cannot access the field usage stats API with the rest client nor the python elasticsearch-py client.

When we issue my-index/_field_usage_stats via cerebro, we get:

{
  "error": "Incorrect HTTP method for uri [/my-index/_field_usage_stats] and method [GET], allowed: [POST]",
  "status": 405
}

From the documentation, it seems like it should be available in ES 7.17: https://www.elastic.co/guide/en/elasticsearch/reference/7.17/field-usage-stats.html

Steps to Reproduce

Just issuing the HTTP request on an ES 7.17 cluster

Logs (if relevant)

No response

pxsalehi commented 2 years ago

@omrikurtz thanks for reporting the issue. I have tried to quickly reproduce this on 7.17.6, but I cannot. I just started a local ES, and issued:

curl -X POST localhost:9200/my-index-01/_doc -H 'Content-Type: application/json' -d '{"f1": "v1"}'

And then

curl -X GET localhost:9200/my-index-01/_field_usage_stats

which seems to work and return:

{"_shards":{"total":1,"successful":1,"failed":0},"my-index-01":{"shards":[{"tracking_id":"uD_rWv6MRhihfPVqeYjWcw","tracking_started_at_millis":1663059055113,"routing":{"state":"STARTED","primary":true,"node":"ORgRWMRMQL2hbLeYsnHW8A","relocating_node":null},"stats":{"all_fields":{"any":2,"inverted_index":{"terms":0,"postings":0,"term_frequencies":0,"positions":0,"offsets":0,"payloads":0,"proximity":0},"stored_fields":2,"doc_values":0,"points":0,"norms":0,"term_vectors":0},"fields":{"_id":{"any":1,"inverted_index":{"terms":0,"postings":0,"term_frequencies":0,"positions":0,"offsets":0,"payloads":0,"proximity":0},"stored_fields":1,"doc_values":0,"points":0,"norms":0,"term_vectors":0},"_source":{"any":1,"inverted_index":{"terms":0,"postings":0,"term_frequencies":0,"positions":0,"offsets":0,"payloads":0,"proximity":0},"stored_fields":1,"doc_values":0,"points":0,"norms":0,"term_vectors":0}}}}]}

Could you provide more details please and also which exact ES version? Do you have a minimal setup where you encounter this issue?

elasticsearchmachine commented 2 years ago

Pinging @elastic/es-search (Team:Search)

javanna commented 2 years ago

I briefly looked at the code as well, and it seems that _field_usage_stats supports GET and not POST. I am wondering if you end up hitting a different endpoint, what response do you get when trying POST?

javanna commented 2 years ago

Closing for lack of feedback, feel free to reply with the relevant info and we'll reopen it.