Skip to content

AWS OpenSearch Service: How to Use a Custom ScriptPlugin or Alternative Approach

0

Hello,

I am trying to import a custom OpenSearch plugin into AWS OpenSearch Service, but the import fails with validation error:

PluginValidationFailureReason: Class org.opensearch.plugin.skiplist.SkipListPlugin implements the plugin interface org.opensearch.plugins.ScriptPlugin which is not supported.

My plugin is a custom ScriptPlugin that:

  • Implements a Bloom filter-style skip list for efficient document skipping.
  • Uses RoaringBitmap for compact ID tracking and filtering in OpenSearch queries.
  • Is designed to avoid fetching already-seen documents by checking an ID set inside a script.
  • It requires ScriptPlugin as it checks each individual document ID and adjust its score based on existence in the bloom filter.

Questions:

  • Is there any AWS-approved way to use a custom ScriptPlugin in AWS OpenSearch Service?
  • Does AWS provide a manual validation process to approve custom plugins (checking my plugin individually)?
  • Are there any AWS-supported alternatives to efficiently implement a Bloom filter-based document skipping in OpenSearch without a custom plugin?
  • If self-hosting OpenSearch on AWS EC2, what are the recommended security measures to match AWS OpenSearch Service's built-in security?

I want to stay on AWS-managed OpenSearch if possible, but if self-hosting is the only option, I'd like to know the best approach.

Thanks in advance for any insights!

asked 2 years ago366 views

1 Answer
1
Accepted Answer

Unfortunately, AWS OpenSearch Service does not currently support custom ScriptPlugins. The validation error you encountered indicates that plugins implementing the ScriptPlugin interface are not allowed in the managed service.

AWS OpenSearch Service has strict limitations on custom plugins for security and performance reasons. While they do support some types of custom plugins, ScriptPlugins are not among the supported extensions. There is no manual validation process to approve individual custom plugins that fall outside the supported types.

As an alternative to using a custom ScriptPlugin for implementing a Bloom filter-based document skipping mechanism, you might consider the following approaches within AWS OpenSearch Service:

  1. Use OpenSearch's native scripting capabilities: While not as efficient as a custom plugin, you could implement some of the logic using OpenSearch's supported scripting languages like Painless. This would allow you to perform some document filtering and scoring adjustments, albeit with potential performance trade-offs.

  2. Pre-process your data: Instead of using a Bloom filter at query time, you could pre-process your data to add flags or metadata to documents indicating their status. This could then be used in queries to filter or adjust scoring without needing a custom plugin.

  3. Utilize OpenSearch's built-in features: Explore using a combination of OpenSearch's native features like filters, query rescoring, and function score queries to achieve similar functionality without a custom plugin.

If these alternatives don't meet your specific requirements and you decide to self-host OpenSearch on EC2, you should implement several security measures to approach the level of security provided by AWS OpenSearch Service:

  1. Use VPC for network isolation
  2. Implement encryption at rest using AWS KMS
  3. Enable encryption in transit (TLS)
  4. Use IAM roles for EC2 instances
  5. Implement fine-grained access control
  6. Regular security patching and updates
  7. Enable CloudTrail for API call logging
  8. Use Security Groups for firewall rules
  9. Implement multi-factor authentication for administrative access

While self-hosting gives you more flexibility with custom plugins, it also increases your operational overhead and security responsibilities. If possible, it's generally recommended to stay with the managed AWS OpenSearch Service for its built-in security, scalability, and maintenance benefits.
Sources
Custom plugins - Amazon OpenSearch Service
Plugins by engine version in Amazon OpenSearch Service - Amazon OpenSearch Service
Amazon OpenSearch Service now supports Custom Plugins - AWS

answered 2 years ago

EXPERT

reviewed 2 years ago

  • Hetey! Thank you for prompt response!

    I have found out that for my purpose I need just a simple must_not and value_type "bitmap" in my complex query. No need to migrate the old ElasticSearch scoring plugin. Thank you OpenSearch 2.17+!!!

    { "query": { "bool": { "must": { "match_all": {} }, "must_not": { "terms": { "bf": ["base64encodedRoaringBitmap"], "value_type": "bitmap" } } } } }

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.