# How to invoke plugin using opensearch-java client library?

**URL:** <https://forum.opensearch.org/t/how-to-invoke-plugin-using-opensearch-java-client-library/14854>\
**Category:** OpenSearch Client Libraries\
**Tags:** opensearch-java\
**Created:** [June 28, 2023, 5:33am UTC](https://forum.opensearch.org/t/how-to-invoke-plugin-using-opensearch-java-client-library/14854 "2023-06-28T05:33:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajesh](https://avatars.discourse-cdn.com/v4/letter/r/8e7dd6/32.png) [@rajesh](https://forum.opensearch.org/u/rajesh)\
**Post date:** [June 28, 2023, 5:33am UTC](https://forum.opensearch.org/t/how-to-invoke-plugin-using-opensearch-java-client-library/14854/1 "2023-06-28T05:33:08Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser): OpenSearch 2.8.0  
**Describe the issue** : We have custom opensearch plugin. We have been using rest high level client. Since rest high level client will be deprecated from OpenSearch 3.0.0 onwards, we want to migrate to opensearch-java client library. How do we invoke customer plugin from opensearch-client APIs. In order to use opensearch-java client library, I had to make changes in org.opensearch.client.opensearch.\_types.aggregations.Aggregate, org.opensearch.client.opensearch.\_types.aggregations and some other files. Please share if there any way I can use our plugin without making changes to client library.

**Configuration** :

**Relevant Logs or Screenshots** :

---

<div class="post-metadata">

**Author:** ![wbeckler](https://avatars.discourse-cdn.com/v4/letter/w/9d8465/32.png) [@wbeckler](https://forum.opensearch.org/u/wbeckler)\
**Post date:** [July 2, 2023, 3:50am UTC](https://forum.opensearch.org/t/how-to-invoke-plugin-using-opensearch-java-client-library/14854/2 "2023-07-02T03:50:49Z")

</div>

Would this address your use case? Maybe you can comment on the issue to broaden the scope or reinforce the use case?

> <https://github.com/opensearch-project/opensearch-java/issues/540>
>
> \### Is your feature request related to a problem?
> 
> Some plugins such as the \[O…penSearch LTR plugin\](https://github.com/opensearch-project/opensearch-learning-to-rank-base) add additional query variants https://elasticsearch-learning-to-rank.readthedocs.io/en/latest/searching-with-your-model.html#searching-with-ltr.
> 
> opensearch-java current cannot support construction of a query containing such a query variant as \[QueryVariant\](https://github.com/opensearch-project/opensearch-java/blob/main/java-client/src/main/java/org/opensearch/client/opensearch/\_types/query\_dsl/QueryVariant.java#L44) interface requiring a kind being specified and \[Query.Kind\](https://github.com/opensearch-project/opensearch-java/blob/main/java-client/src/main/java/org/opensearch/client/opensearch/\_types/query\_dsl/Query.java#L69) being a enum, not allowing for variants to be specified in a 3rd party client.
> 
> \### What solution would you like?
> 
> There would be a couple possible solutions to this problem. Converting the enum to a type which allows for open extension might be one. Add a \`custom\` variant to the enum which itself allows for a flexible query construction might be another.
> 
> \### What alternatives have you considered?
> 
> See above
> 
> \### Do you have any additional context?
> 
> N/A

---

<div class="post-metadata">

**Author:** ![rajesh](https://avatars.discourse-cdn.com/v4/letter/r/8e7dd6/32.png) [@rajesh](https://forum.opensearch.org/u/rajesh)\
**Post date:** [July 3, 2023, 8:08am UTC](https://forum.opensearch.org/t/how-to-invoke-plugin-using-opensearch-java-client-library/14854/3 "2023-07-03T08:08:09Z")

</div>

Yes. This feature will address our usecase. Thanks for sharing github issue link.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/3/33547ea01a5b12dcca2958411d3edd97ae2ea8c1.png) [@system](https://forum.opensearch.org/u/system)\
**Post date:** [September 1, 2023, 8:08am UTC](https://forum.opensearch.org/t/how-to-invoke-plugin-using-opensearch-java-client-library/14854/4 "2023-09-01T08:08:51Z")

</div>

Closed on September 1, 2023, 8:08am UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
