Redirect REST API request to another REST API in OpenSearch

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
OpenSearch Version: 2.18.0
Fluentbit Version: 1.16

Describe the issue:
I am working with a setup of fluentbit v1.16 sending records to OpenSearch v2.18.0 which I know is not possible as “_type” field has been removed from bulk request in OpenSearch 2.x and it will throw an error.

I had come up with a solution of removing “_type” field and value from the request body by adding a new handler “/_custom_bulk” in OpenSearch via plugins which solved half of the problem.

The other half is to make the client i.e. fluentbit send the request at this new handler.
One thing I want to highlight here is that I can’t change anything on fluentbit and while I have figured out the configurations to reverse proxy using nginx, it is also something I don’t want to use as it involves introducing a new component into the solution with its overhead.

Therefore, I wanted to know if it’s possible to do a request redirection from within OpenSearch without building OpenSearch from scratch on my own.

Configuration:
N/A

Relevant Logs or Screenshots:
N/A

I don’t know much about OpenSearch internals, but if I understand your question correctly, I don’t think you could do it without a reverse proxy, or else using a custom fork of OpenSearch.

I like to use Caddy for reverse-proxying. I think a Caddyfile like this would do what you need:

public.myopensearch.com {
    handle_path /bulk* {
        reverse_proxy https://myopensearch.com/_custom_bulk
    }
    handle {
        reverse_proxy https://myopensearch.com/
    }
}