danielberkompas/elasticsearch-elixir

Error with the elasticsearch.build task

michalmuskala opened this issue · 3 comments

Library version: 0.5.1

While trying to run the elasticsearch.build task for the first time in the new project against the server from Elastic Cloud.

The error is:

** (Mix) Index resources could not be created. 

%Elasticsearch.Exception{col: nil, line: nil, 
  message: "forcemerge takes arguments in query parameters, not in the request body", 
  query: nil, 
  raw: %{
    "error" => %{
      "reason" => "forcemerge takes arguments in query parameters, not in the request body", 
      "root_cause" => [%{"reason" => "forcemerge takes arguments in query parameters, not in the request body", "type" => "illegal_argument_exception"}], 
      "type" => "illegal_argument_exception"
    }, 
    "status" => 400
  }, 
  status: 400, 
  type: "illegal_argument_exception"
}

I don't have much experience with ElasticSearch, but it seems to me that the culprit is this call:

https://github.com/infinitered/elasticsearch-elixir/blob/4776a30214229ad95570395fcb400bef75860013/lib/elasticsearch/indexing/index.ex#L145-L149

Where it passes an empty JSON document as argument instead of passing no body at all, but I'm not 100% sure.

Thanks for the bug report! Which version of Elasticsearch are you using?

@michalmuskala I reproduced this on Elasticsearch 6.4.0, and pushed a new version to fix it: 0.5.2. Can you let me know if it works for you?

Yes, it was 6.4 indeed and it does work now. Thank you.