Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
niuage opened this issue Dec 8, 2015 · 1 comment
Closed

Comments

@niuage
Copy link

niuage commented Dec 8, 2015

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

@niuage niuage changed the title The "refresh", and "index" options don't work well together The "refresh", and "index" options of Model.import don't work well together Dec 8, 2015
ganta added a commit to ganta/elasticsearch-rails that referenced this issue Apr 1, 2017
ganta added a commit to ganta/elasticsearch-rails that referenced this issue Apr 9, 2017
@estolfo
Copy link
Contributor

estolfo commented Sep 5, 2018

Closing this as the pull request #692 was merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants