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

Using POST body for search #391

Closed
NathanHazout opened this issue Apr 11, 2016 · 2 comments
Closed

Using POST body for search #391

NathanHazout opened this issue Apr 11, 2016 · 2 comments

Comments

@NathanHazout
Copy link

Using the simplest query:

client.search({q:"hello world})

I see from the network traffic that the request is POST but using URL query parameters: POST /_search?q=hello%20world HTTP/1.1. The request has no body.

Following the simple example in the documentation (https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/quick-start.html):

client.search({
  index: 'twitter',
  type: 'tweets',
  body: {
    query: {
      match: {
        body: 'elasticsearch'
      }
    }
  }
})

I see from the network traffic that it is making an OPTIONS request instead:
OPTIONS /twitter/tweets/_search HTTP/1.1

I am using the jQuery build (v10.1.3 - 2016-01-26)

@spalger
Copy link
Contributor

spalger commented Apr 11, 2016

I imagine what you are seeing is the preflight request sent by browsers for cross-domain requests.

@NathanHazout
Copy link
Author

Ok according to some research, it seems to be related to this issue:
elastic/elasticsearch#17483

Fix to be released with 2.3.2 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants