Skip to content

The "refresh", and "index" options of Model.import don't work well together #506

Closed
@niuage

Description

@niuage

Hey,

tl;dr: in Model.import, self.refresh_index! is called without specifying the index to refresh, which I think is an issue if you specify the index option.


I have a rake task that goes something like...

new_index_name = args[:index_name]

Map.__elasticsearch__.create_index! index: new_index_name
Map.import(
    index: new_index_name,
    refresh: true,
    query: -> { includes(map_items: :item) }
)

If I run rake map:reindex[map_index], then new map_index index will be created properly, and the maps will be imported in the right index, but the wrong index will be refreshed.

POST http://localhost:9200/alias_maps_development/_refresh

alias_maps_development being the actual index of my model (well, it's an alias).

Is this behavior intended? Shouldn't refresh refresh the index that's being passed as an option? (lib/elasticsearch/model/importing.rb:130)

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions