elastic / elasticsearch-php

Official PHP client for Elasticsearch.
https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/index.html
MIT License
5.25k stars 964 forks source link

406 Not Acceptable: {"error":"Content-Type header [application/vnd.elasticsearch+json; compatible-with=8] is not supported","status":406} #1347

Closed hiteshsamcom closed 11 months ago

hiteshsamcom commented 11 months ago

Summary of problem or feature request

I'm getting this below error image

Code snippet of problem

$client = ClientBuilder::create()->setHosts(config('database.connections.elasticsearch.hosts'))->build();

$searchTerm = $request->input('search');

$params = [
    'index' => '<index>',
    'body' => [
        'query' => [
            'match' => [
                'name' => $searchTerm,
            ],
        ],
    ],
];

$response = $client->search($params);

System details

ezimuel commented 11 months ago

In the system details you specified using AWS OpenSearch, I'm sorry but the elasticsearch-php v8+ supports only Elasticsearch.