Skip to content

NEST 2.0.0-Alpha 1: Using the GetDescriptor #1714

Closed
@andersosthus

Description

@andersosthus

Hi,

I'm having a bit of an issue understanding the usage of the GetDescriptor

Usecase: None of our ES types have domain models. We have one generic model that we use for everything (JsonObject, basically a Dict), so we're not using any of the typed features in NEST.

Now I want to get the document at /test/stuff/1

Doing the following works fine, but feels a bit wonky:

var document = new DocumentPath<JsonObject>("1");
var getDescr = new GetDescriptor<JsonObject>(document)
    .Index("test")
    .Type("stuff");

var res = client.Get<JsonObject>(getDescr);

Then, by accident, I found out that the following works:

var getDescr = new GetDescriptor<JsonObject>(new Id("1"))
    .Index("test")
    .Type("stuff");
var res = client.Get<JsonObject>(getDescr);

Looking at the signature of GetDescriptor it doesn't look like that's a valid use on a quick glance, but it works, and is kind of what I expected. This could maybe have been better highlighted in the signature of GetDescriptor. And if it is a bug that it works, please make it into a feature :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions