Skip to content

Add support for create actions in the node client #29

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

Conversation

pickypg
Copy link
Contributor

@pickypg pickypg commented Dec 4, 2014

  • Adds validation to require _id for create actions (including for the http protocol)

Help: I don't know how to properly test for the error condition. The "create action fails without _id" test fails because I'm not testing it right, but I don't know how to properly catch the error.

Note: #2 (retry on bulk failure) may need to special case failure to create (ignore it).

Closes #28

- Adds validation to require `_id` for create actions (including for the http protocol)
@talevy
Copy link
Contributor

talevy commented Dec 4, 2014

@pickypg looks good! Until we merge #2, I do not see how to verify failure well. The current behavior of the elasticsearch output is to drop messages that failed in bulk because the response is not checked for failures.

is this an urgent change?

@pickypg
Copy link
Contributor Author

pickypg commented Dec 5, 2014

@talevy I'd like to get the change in and honestly I think people expect the current behavior from create (drop and ignore).

The integration tests definitely do not behave that way though. As I have it, the "create action fails without _id" test always fails and it seems to loop trying to resend the action (I want to have a test, but I didn't know how to stop the resending behavior). Should I just drop that test and merge this?

@jordansissel
Copy link
Contributor

@pickypg Any behavior that results in "drop on error" should be very loudly documented. Are you proposing that create-with-an-id-that-already-exists should result in a dropped event?

@pickypg
Copy link
Contributor Author

pickypg commented Dec 8, 2014

@jordansissel Yes. In the logging use case, selecting this is very manual and it seems quite intentional. If you don't want it, then leaving it as "index" (default) would suffice.

@jordansissel
Copy link
Contributor

I wonder if we should make it more explicit, call it create_unless_exists ?

@pickypg
Copy link
Contributor Author

pickypg commented Dec 8, 2014

I'm fine with modifying it that way, but that means we have to further special case it for the non-node clients. Then I suppose we could separately have "create" as-is (though retry on bulk failure may get clumsy here as it's unlikely to ever be successful unless an earlier delete had failed) without the ID validation.

@jordansissel
Copy link
Contributor

@pickypg yeah, I'm less worried about the specific implementation details (special-casing) and more concerned with having an interface and terminology that is most-obvious (nobody will read docs to know what Elasticsearch's create really means).

@pickypg
Copy link
Contributor Author

pickypg commented Dec 8, 2014

@jordansissel Fine by me. I'll find time to update the PR. Do you have any thoughts on how to appropriately test it? It's my lack of Ruby knowledge doing me in, but I'd like to see this make it in.

@jordansissel
Copy link
Contributor

@pickypg yep! We'll get someone helping you out with that this week or next. This should be doable for 1.5's timeline

@jordansissel
Copy link
Contributor

Thinking more outloud - Once we have @colinsurprenant's persistent-queue work merged as well as the dead-letter-queueing, we could just have this be "create" and a failure would dump into the DLQ.

For 1.5, I think 'create_unless_exists' is what to do. For 2.0, we can add 'create' also but shunting errors to the DLQ.

@suyograo
Copy link
Contributor

testing for failures requires changes in #2 to get in.

…or both

- "create_unless_exists" will require the ID, while "create" does not require it and effectively behaves identically to "index".
- An error is raised if unknown actions are supplied
@suyograo
Copy link
Contributor

@pickypg @talevy wanted to rebase this after #2 got merged in

@suyograo
Copy link
Contributor

Closed in lieu of #39

@suyograo suyograo closed this Jan 21, 2015
@pickypg pickypg deleted the feature/create-action-28 branch January 21, 2015 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node Protocol Client does not support create requests
5 participants