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

Multiple indexes per model #595

Closed
matclayton opened this issue Jun 21, 2012 · 7 comments
Closed

Multiple indexes per model #595

matclayton opened this issue Jun 21, 2012 · 7 comments

Comments

@matclayton
Copy link

We have a potential use case where we would like to have multiple indexes per model, and haystack seems to prohibit this at the moment. These indexes would be very different and use different fields etc.

Maybe the solution is to combine into a giant index, however it feels like it would be good to allow multiple indexes per models. Especially when thinking about internal and external tooling.

@toastdriven
Copy link
Contributor

Unfortunately, this is a non-starter. Haystack (especially in querying) has to be able to know what model to be able to load up & it's very difficult if there isn't a 1-to-1 mapping.

One big index is the typical way I recommend handling this case. You have a powerful, (relatively) schemaless data store, so denormalization is your friend.

@matclayton
Copy link
Author

Not sure I understand, so we would like 2 indexes in ElasticSearch for the one django model. Doesn't this mean just duplicating the id field in one index into two? I would have thought querying would be fine, but rather writing to the search index would be problematic?

@jjdelc
Copy link

jjdelc commented Nov 23, 2013

I got around this using proxy models, Haystack wont complain if you create indexes for them.

@joestump
Copy link

joestump commented Oct 5, 2014

By not supporting this, I believe, it also keeps people from A/B testing different indexing methodologies for a given model. We're revisiting our initial implementation of Haystack and I really wish alongside using=CONNECTION_NAME I could use index=INDEX_CLS. @matclayton the best I've found as far as implementing this goes is to use the EXCLUDED_INDEXES setting in the HAYSTACK_CONNECTIONS in settings.

I agree with the "1 model per index" model, but wish I had more control over routing so I could maintain multiple competing indexes for a given model.

@thedrow
Copy link

thedrow commented Oct 21, 2014

This is very useful for creating an index per user per model in order to handle object level permissions.
I'd really this to be reconsidered.

@grjones
Copy link

grjones commented Nov 3, 2017

There are many uses cases for needing multiple indexes for a single model. We had to do this using hacks in our project. +1 to make this a real thing.

@acdha
Copy link
Contributor

acdha commented Nov 5, 2017

@grjones a fair amount has changed in the last 5 years since this ticket was created. If you have an idea for how this could be implemented, I think it'd be best to open an issue or pull request with a concrete use-case and proposed implementation strategy.

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

7 participants