elastix icon indicating copy to clipboard operation
elastix copied to clipboard

Elasticsearch 7 Mapping

Open gabriel137 opened this issue 6 years ago • 7 comments

How is the code now to assign as mapping settings? I'm trying a few ways with a new application, but I only have this return error:

Types cannot be provided in placement mapping requests unless the include_type_name parameter is set to true. "

gabriel137 avatar Apr 15 '20 18:04 gabriel137

I ended up finding a way, just do the process of inserting the data and the attributes will be created automatically

Elastix.Document.index (elastic_url, "twitter", "_doc", "1", date)

But now I'm trying to find out how to search for a file that looks like it has been changed too.

gabriel137 avatar Apr 15 '20 20:04 gabriel137

Mapping.put(url, index_name, type, mapping, include_type_name: true) should work.

nilcolor avatar Jun 02 '20 21:06 nilcolor

Changed, now is like this:

Elastix.Document.index (elastic_url, "twitter", "_doc", "1", date)

gabriel137 avatar Jun 11 '20 17:06 gabriel137

I made a very basic module based on Elastix.Mapping that works to create an index in 7 without warnings:

defmodule Elastix.NewMapping do
  import Elastix.HTTP, only: [prepare_url: 2]
  alias Elastix.{HTTP, JSON}

  def put(elastic_url, index_name, data) do
    prepare_url(elastic_url, "/#{index_name}/_mapping")
    |> HTTP.put(JSON.encode!(data))
  end
end

Elastix.NewMapping.put(elastic_url, "search", %{
  properties: %{
    content: %{type: "search_as_you_type"}
  }
})

sb8244 avatar Oct 27 '20 00:10 sb8244

@sb8244 Thanks, your workaround works. Waiting for this to be resolved in the package.

costa avatar Dec 23 '20 19:12 costa

Well... it's worth noting this is not the only change needed for ES7 support: Elastix.Search.search, Elastix.Document.index, Elastix.Document.delete and others have to have "type" arguments removed — for now, giving "_doc" for the latter seems to work around that.

costa avatar Dec 23 '20 21:12 costa

Is it planned to support Elasticsearch 8? (mapping types are not supported anymore)

mruoss avatar Mar 17 '22 12:03 mruoss