-
Notifications
You must be signed in to change notification settings - Fork 810
Closed
Labels
@dwkoogt
Description
Hi.
I have models that have custom index properties defined in the mapping. The values for these properties are computed when as_indexed_json is called. However, update_index call in Elasticsearch::Model::Indexing checks for changed attributes and only selects those values from as_indexed_json missing all the custom index properties.
see the :custom_prop in below class.
class M
field :id
field :name, type: String
mappings do
indexes :id, index: :not_analyzed
indexes :name, analyzer: 'standard'
indexes :custom_prop
end
def as_indexed_json(options={})
_hash = as_json(only: [name])
_hash['custom_prop'] = "some computed value"
end
end