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

Delete method throw exception #651

Closed
vovikdrg opened this issue May 8, 2014 · 1 comment
Closed

Delete method throw exception #651

vovikdrg opened this issue May 8, 2014 · 1 comment

Comments

@vovikdrg
Copy link
Contributor

vovikdrg commented May 8, 2014

_client.Delete("id", s => s
    .Type("users")
    .Index("myindex")
);

Throws exception

Could not dispatch IElasticClient.Delete() into any of the following paths: 
 - /{index}/{type}/{id}

But should not

When i cast it to object (Delete<object>) then it works.

@Mpdreamz
Copy link
Member

The Delete overload you are calling is actually:

_client.Delete<string>("id", s => s
    .Type("users")
    .Index("myindex")
);

It then tries to infer the id from the string "id" which fails. The first argument in this case is also called obj and not id.

I've added an convenience extension method for this usecase though (where providing a CLR type for the delete operation might not be needed)

Now you should be able to do:

.Delete("index","type","id", s => s)

The latter lambda to further describe the delete operation being optional.

Thanks for reporting @vovikdrg 👍

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