Skip to content

FieldLookup should include "routing" property #2261

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
seanwm opened this issue Sep 14, 2016 · 3 comments
Closed

FieldLookup should include "routing" property #2261

seanwm opened this issue Sep 14, 2016 · 3 comments

Comments

@seanwm
Copy link

seanwm commented Sep 14, 2016

Describe the feature:

As documented here:

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html

the Terms Query lookup supports a "routing" option, necessary when referencing a document in an index that uses custom routing. I need to use this, but NEST doesn't currently support that routing option with the FieldLookup class. Any chance we could see that added?

@seanwm
Copy link
Author

seanwm commented Sep 14, 2016

Workaround for anyone else running into this:

public class RoutableFieldLookup : IFieldLookup
{
    public Id Id { get; set; }
    public IndexName Index { get; set; }
    public Field Path { get; set; }
    public TypeName Type { get; set; }
    [JsonProperty("routing")]
    public string CustomRouting { get; set; }
}

That plain ol' string property isn't going to do anything to make sure your routing value makes any sense, so caveat coder.

@Mpdreamz
Copy link
Member

Thanks @seanwm we'll add it to our next releases 👍

Side note: I'm super happy you were able to hack what you needed through implementing our interface with your own class. This is exactly why we made such a push for interface everywhere! 😄

@seanwm
Copy link
Author

seanwm commented Sep 15, 2016

Thanks. And yeah, I was really pleasantly surprised that I could just drop in my simple replacement class, kudos!

gmarz added a commit that referenced this issue Sep 21, 2016
Fix #2261 add missing Routing option to FieldsLookup
gmarz added a commit that referenced this issue Sep 21, 2016
Fix #2261 add missing Routing option to FieldsLookup
@gmarz gmarz closed this as completed in e57c8c1 Sep 21, 2016
gmarz added a commit that referenced this issue Sep 21, 2016
Fix #2261 add missing Routing option to FieldsLookup
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

3 participants