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

rest.index/refresh fails for Elasticsearch 5 #257

Closed
hantuzun opened this issue Sep 8, 2017 · 5 comments
Closed

rest.index/refresh fails for Elasticsearch 5 #257

hantuzun opened this issue Sep 8, 2017 · 5 comments

Comments

@hantuzun
Copy link
Contributor

hantuzun commented Sep 8, 2017

When I updated Elasticsearch to 5.5.2, our rest.index/refresh calls started to fail with a message from clj-http that "text/plain" content type is not acceptable.

Updating clojurewerkz.elastisch.rest's post function with a :content-type :json setting fixed the issue for me, without breaking other hundreds of tests using elastisch for our application:

(defn post
  ([^Connection conn ^String uri]
   (post conn uri {}))
  ([^Connection conn ^String uri {:keys [body] :as options}]
    (-> uri
        (http/post (merge (.http-opts conn)
                          options
                          {:accept :json
                           :content-type :json
                           ;:throw-exceptions false ;;ables to see ES when debugging
                           :body (json/encode body)}))
        (:body)
        (parse-safely))))
@michaelklishin
Copy link
Member

See Supported ElasticSearch versions and #245.

@michaelklishin
Copy link
Member

@hantuzun if you'd like to contribute this small improvement, a pull request against master would be appreciated.

@hantuzun
Copy link
Contributor Author

hantuzun commented Sep 9, 2017

Hi @michaelklishin, I fear that change might break some features in some of the many Elasticsearch versions supported.

@michaelklishin
Copy link
Member

@hantuzun I don't see how adding a content type can break anything. In any case, no PRs for 5.x will be merged until 3.0 is released.

@hantuzun
Copy link
Contributor Author

I've already forked elastisch to my account and we're using it. It'd be a hassle to fork it again for this PR that's not merged.

Hopefully 3.0 could be released soon and we could work on Elasticsearch 5.x support.

briantrice pushed a commit to briantrice/elastisch that referenced this issue Apr 19, 2018
Error from Elasticsearch 5 without this is:
"Content type detection for rest requests is deprecated. Specify the content type using the [Content-Type] header."

Per clojurewerkz#257
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