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

Strict routing #72

Open
M1ha-Shvn opened this issue May 22, 2017 · 3 comments
Open

Strict routing #72

M1ha-Shvn opened this issue May 22, 2017 · 3 comments

Comments

@M1ha-Shvn
Copy link

M1ha-Shvn commented May 22, 2017

Is there a way to fetch models with strict routing set in ElasticSearch settings?
I get TransportError(400, 'RoutingMissingException[...])
When I try to call MyModel.es.get(id=100500) method

@lauxley
Copy link
Contributor

lauxley commented May 24, 2017

I can't find it in the documentation ?
What version of es ?
What if you try with elasticsearch-py directly ?

@M1ha-Shvn
Copy link
Author

M1ha-Shvn commented May 24, 2017

I speak about this elasticsearch parameter.
I used elasticsearch-py directly before starting using this library. Every request in es-py library has routing parameter, get(), for instance.
But I can't specify this parameter in django-elasticsearch without modifying method in subclass, as it doesn't pass kwargs to native elasticsearch-py get() method.
P. s. routing is not strict in ES by default. So requests can be done without this parameter. But our system uses strict routing, as it

can reduce the impact of searches

It is defined by mapping (I've written a subclass over ElasticsearchManager in order to define custom mapping):

"_routing": {
        "required": True,
        "path": "app_id"
},

P. p. s. Yes, I'm still using elastisearch-py directly nowadays. But to my mind, it's not good to have library (I use it for migrating databases and UnitTest purposes) and have it's part (all data fetching) not working...

@lauxley
Copy link
Contributor

lauxley commented May 24, 2017

I'm not saying that you should use elasticsearch-py to do this, I'm was only trying to understand what the issue is.
As you said, it's not possible for now, a quick fix would be to propagate kwargs in get() but maybe it would be better to abstract it with a routing attribute or something.

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