Error sending trace data to elasticsearch using otel collector

Hi,

I'm trying to send trace data to Elasticsearch using otel collector. and below is my configuration. when I send sample traces I get the below error messages:

When I have httpsin the endpoint url

Error: Exporting failed. The error is not retryable. Dropping data." component=otelcol.exporter.otlphttp.elastic error="Permanent error: error exporting items, request to https://elasticsearch:9200/v1/traces responded with HTTP Status Code 406" dropped_items=1-removd colons around the url

When I use http in the endpoint url

Error: Exporting failed. Will retry the request after interval." component=otelcol.exporter.otlphttp.elastic error="failed to make an HTTP request: Post \"http://elasticsearch:9200/v1/traces\": EOF" interval=10.73036973s
apiVersion: v1
kind: ConfigMap
metadata:
  name: grafana-agent-config
data:
  grafana-agent.river: |

    otelcol.exporter.otlphttp "elastic" {
      client {
        endpoint = "https://elasticsearch:9200"
        auth = otelcol.auth.basic.elastic.handler
        tls{
          ca_file = "/path/to/certs.pem"
        }
      }
    }

    otelcol.auth.basic "elastic" {
      username = "userid"
      password = "password"
    }

    otelcol.receiver.otlp "otel" {
      grpc {
        endpoint = "0.0.0.0:4317"
      }

      http {
        endpoint = "0.0.0.0:4318"
      }

      output {
        metrics = [otelcol.exporter.otlphttp.elastic.input]
        logs    = [otelcol.exporter.otlphttp.elastic.input]
        traces  = [otelcol.exporter.otlphttp.elastic.input]
      }
    }

    logging {
     level = "debug"
    }