I have the following setup in my Comment model:
searchkick callbacks: :async, highlight: [:comment], word_start: [:comment], word_middle: [:comment], searchable: [:comment],
merge_mappings: true,
mappings: {
comment: {
properties: {
comment: {type: "text", analyzer: "standard"}
}
}
}
When I attempt to reindex, I get the following error:
Elasticsearch::Transport::Transport::Errors::BadRequest: [400] {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Mapping definition for [comment] has unsupported parameters: [ignore_above : 30000]"}],"type":"mapper_parsing_exception","reason":"Failed to parse mapping [comment]: Mapping definition for [comment] has unsupported parameters: [ignore_above : 30000]","caused_by":{"type":"mapper_parsing_exception","reason":"Mapping definition for [comment] has unsupported parameters: [ignore_above : 30000]"}},"status":400}
I know it is coming the searchkick gem but don't know if I have something specified incorrectly on my end or if there is a way to work around this.
Actually it looks like this is specific to the type: "text" for the property. You can see this here
Same here :confused:
full_name: { type: 'text', analyzer: 'searchkick_text_middle_index' },
"root_cause":[{"type":"mapper_parsing_exception","reason":"Mapping definition for [full_name] has unsupported parameters: [ignore_above : 30000]"}]
ES 5.3
Seachkick 2.1.1
@chadwilken Besides the broken build, do you reckon this PR would fix that issue?https://github.com/ankane/searchkick/pull/1014/files
@matcouto that looks like it would address the problem. Thanks for creating the PR!
Hey @chadwilken, the problem is your custom mapping. I'd recommend removing it.
Hi @ankane thanks for reviewing the PR. I've just closed it as you said the change was not necessary, though, I was wondering what it is wrong with custom mappings and why its use is not recommended?
Cheers
@matcouto Because it can break things unless you really know what you're doing
I'll try removing the custom mappings and see how it works out. I didn't develop this feature initially so I am trying to figure out what all is necessary. Thanks for the input.
Is there a workaround for this? I do need to use the custom mapping
@alienxp03 I'd suggest switching entirely to the Elasticsearch DSL if you need that
Had the same thought too. Thanks for confirming that @ankane.