Skip to content
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

Skipping index generation for Searchkick-enabled Model #1210

Closed
matteoredz opened this issue Nov 29, 2018 · 4 comments
Closed

Skipping index generation for Searchkick-enabled Model #1210

matteoredz opened this issue Nov 29, 2018 · 4 comments

Comments

@matteoredz
Copy link

Hi, we have an issue with Searchkick. We have a resource being indexed by another application, and the index name is fixed. We need Searchkick to access that index. We already managed to avoid the model being indexed (by setting should_index to false)
if we use the index_name option, Searchkick will append a timestamp to that
Will it still be able to access our existing index or is there anything else to do to achieve that?

@matteoredz matteoredz changed the title should_index? method ignored under certain conditions Skipping index generation for Searchkick-enabled Model Nov 29, 2018
@ankane
Copy link
Owner

ankane commented Nov 29, 2018

Hey @matteoredz, can you provide more details about what you're seeing? Searchkick doesn't append a timestamp to the index name when searching.

@matteoredz
Copy link
Author

Hi @ankane, the index structure is model_name_timestamp but I've an index injected from an external web app structured ad my_index_name without timestamp.

In my main application I've mapped self.index_name to match the index name injected by the other app.

My question is: Is there any - documented - way to skip indexing from Searchkick (which would generate my_index_name_timestamp) and use it as read-only using this gem?

@ankane
Copy link
Owner

ankane commented Nov 30, 2018

You can turn callbacks off with callbacks: false, but someone could always reindex manually. The best way would be to give read-only access with X-Pack or your hosted provider.

@matteoredz
Copy link
Author

matteoredz commented Nov 30, 2018

Ok, at this stage I've overrided the rake task:

Searchkick.models.delete_if { |model| model.read_only_index? }.each do |model|
        puts "Reindexing #{model.name}..."
        model.reindex
end

@lock lock bot locked as resolved and limited conversation to collaborators Dec 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants