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

ElasticCommitter - Restrict operation based on action verb (add, update, delete) #1070

Open
stejacob opened this issue Oct 17, 2024 · 2 comments

Comments

@stejacob
Copy link

stejacob commented Oct 17, 2024

Hi,

We would like to restrict specific actions for Elastic committers based on the type of operation (add, update, or delete).

We have three committers, and we're aiming to implement the following restrictions:

  1. One committer should be restricted to only handle English documents based on language field containing value en.
  2. Another committer should be restricted to handle only French documents based on language field containing value fr.
  3. The third committer should be restricted to perform delete operations only.

However, we're unsure if this can be achieved with the current configuration. At the moment, using the restrictTo option based on a field causes delete commands to be rejected, as the field doesn't exist in the document being deleted.

If this is not yet supported, would it be possible to open an enhancement request?

Any guidance on how to achieve this setup would be greatly appreciated.

Thank you.

Stephen Jacob

@essiembre
Copy link
Contributor

That could be useful indeed. I am marking it as a feature request. As a workaround for now, if you know a given field is always there except when deleted, you can add extra committers that are restricted on such a field being empty. You can likely do so by matching the regular expression $^ and making sure matchEmpty is true.

@stejacob
Copy link
Author

Hi Pascal,

We configured below but we are getting "Attribute 'matchEmpty' is not allowed to appear in element 'valueMatcher'".

<committer class="JSONFileCommitter"> <restrictTo> <fieldMatcher method="regex" ignoreCase="true" ignoreDiacritic="true" partial="true"> collections.....new </fieldMatcher> <valueMatcher method="regex" matchEmpty="true"> $^ </valueMatcher> </restrictTo> <directory> ${'./jsonExportAddUpdate/'}</directory> <indent>4</indent> </committer>

Thanks.

Stephen Jacob

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants