Mapping definition for fields has unsupported parameters


(Hieu Dang) #1

I am using OSX El capitan, ES 2.1. When I reindex It throw these errors:

Elasticsearch::Transport::Transport::Errors::BadRequest: [400] {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Mapping definition for [fields] has unsupported parameters: [file : {type=string}]"}],"type":"mapper_parsing_exception","reason":"Failed to parse mapping [attachment]: Mapping definition for [fields] has unsupported parameters: [file : {type=string}]","caused_by":{"type":"mapper_parsing_exception","reason":"Mapping definition for [fields] has unsupported parameters: [file : {type=string}]"}},"status":400}

what is the problem and how to fix? thanks a lot

When I start ES it also threw error

[2016-03-07 08:51:26,982][WARN ][index.translog ] [Scarlet Beetle] [versions][4] failed to delete temp file /usr/local/var/elasticsearch/elasticsearch_capuchino/nodes/0/indices/versions/4/translog/translog-8945599092104577137.tlog java.nio.file.NoSuchFileException: /usr/local/var/elasticsearch/elasticsearch_capuchino/nodes/0/indices/versions/4/translog/translog-8945599092104577137.tlog

I searched and it seem to error in ES 2.1? how to upgrade to 2.2 in mac or have another way to fix?

thanks a lot (bow)


(Mark Walkom) #2

That's the problem. What does the mapping look like.


(Hieu Dang) #3

oh I tried comment out
field :file, type: "string", analyzer... it worked

then how to fix that mapping?


(Mark Walkom) #4

Showing us this would help.


(Hieu Dang) #5
settings analysis: {
      tokenizer: {
        custom_tokenizer: {
          type: "nGram",
          token_chars: %w(letter digit whitespace punctuation symbol)
        }
      },
      analyzer: {
        custom_analyzer: {
          type: "custom",
          tokenizer: "custom_tokenizer",
          filter: "lowercase"
        }
      }
    }
define_type Attachment.active.for_candidates do
    root parent: {type: "candidate"}, parent_id: ->{attachable_id}
    field :file_name, analyzer: "custom_analyzer"
    field :file, type: "attachment", value: ->attachment do
      if attachment.file.present?
        Base64.encode64 open(attachment.file.path){|file| file.read}
      else
        ""
      end
    end do
      field :file, type: "string", analyzer: "custom_analyzer"
    end
  end

here u are :slight_smile:


(Hieu Dang) #6

thanks, I can fixed this
my mistake to not run rake db:migrate :frowning:


(system) #7