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 963 forks source link

Received a 403 Forbidden error when attempting to index #1383

Closed yoss1209 closed 7 months ago

yoss1209 commented 7 months ago

Summary of problem or feature request

When I want to index, I got 403 status

Code snippet of problem

$client =  ClientBuilder::create()
            ->setApiKey('XXXXXXXXXXXX')
            ->setCABundle('path/to/http_ca.cert')
            ->setHosts(['https://elasticsearch-8.myhost.com'])
            ->build();
$client->index($params);

System details

yoss1209 commented 7 months ago

I found the problem; it was because of Cloudflare.