Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Wrong http code returned from create index API with bad input. #2756

Closed
mch2 opened this issue Apr 4, 2022 · 5 comments
Closed

[BUG] Wrong http code returned from create index API with bad input. #2756

mch2 opened this issue Apr 4, 2022 · 5 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest Global event that encourages people to contribute to open-source. Indexing & Search

Comments

@mch2
Copy link
Member

mch2 commented Apr 4, 2022

Describe the bug
Create Index API returning wrong http response code when given invalid input.

To Reproduce

  1. Start up server ./gradlew run
  2. Send a curl request to create an index with invalid input
curl -v -X PUT "localhost:9200/test-index?pretty" -H 'Content-Type: application/json' -d'
adksjhfakldhsf
'

Response:

*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9200 (#0)
> PUT /test-index?pretty HTTP/1.1
> Host: localhost:9200
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Type: application/json
> Content-Length: 16
>
* upload completely sent off: 16 out of 16 bytes
< HTTP/1.1 500 Internal Server Error
< content-type: application/json; charset=UTF-8
< content-length: 390
<
{
  "error" : {
    "root_cause" : [
      {
        "type" : "not_x_content_exception",
        "reason" : "Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"
      }
    ],
    "type" : "not_x_content_exception",
    "reason" : "Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"
  },
  "status" : 500
}
* Connection #0 to host localhost left intact
* Closing connection 0

Expected behavior
This should return http 400 Bad Request.

Plugins
None

Host/Environment (please complete the following information):

  • OS: [e.g. iOS]. Mac
  • Version [e.g. 22] 2.1.0 (current main)
@mch2 mch2 added bug Something isn't working untriaged Indexing & Search and removed untriaged labels Apr 4, 2022
@Poojita-Raj Poojita-Raj added good first issue Good for newcomers hacktoberfest Global event that encourages people to contribute to open-source. labels Sep 29, 2022
@rdanielwetan
Copy link

I would like to take this issue please

@dbwiddis
Copy link
Member

dbwiddis commented Oct 1, 2022

Hi @rdanielwetan thanks for stepping up to help! It's all yours, let us know if you have any questions!

@ayushKataria
Copy link
Contributor

Hi @dbwiddis I would like to take this issue up

@ayushKataria
Copy link
Contributor

@mch2 Opened pull request #4773 for this. Let me know feedback for this.

@anasalkouz
Copy link
Member

The fix already merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest Global event that encourages people to contribute to open-source. Indexing & Search
Projects
None yet
Development

No branches or pull requests

6 participants