# Elasticsearch-php error indexing documents

**URL:** <https://discuss.elastic.co/t/elasticsearch-php-error-indexing-documents/167256>\
**Category:** Elasticsearch\
**Created:** [February 6, 2019, 9:57am UTC](https://discuss.elastic.co/t/elasticsearch-php-error-indexing-documents/167256 "2019-02-06T09:57:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xpico](https://avatars.discourse-cdn.com/v4/letter/x/9fc348/32.png) [@xpico](https://discuss.elastic.co/u/xpico)\
**Post date:** [February 6, 2019, 9:57am UTC](https://discuss.elastic.co/t/elasticsearch-php-error-indexing-documents/167256/1 "2019-02-06T09:57:47Z")

</div>

Hi,

I have elasticsearch-php code to index documents. Until now that works perfect but now i'm having error when try to index document.

This is the error:

```
Fatal error: Uncaught Elasticsearch\Common\Exceptions\BadRequest400Exception: {"error":"Incorrect HTTP method for uri [/hemeroteka/pdf/?pipeline=hemeroteka] and method [PUT], allowed: [POST]","status":405} in /var/www/web/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:615

```

This is my php code to index:

```
 $client = Elasticsearch\ClientBuilder::create()->build();
 $params = [
  'index' => 'hemeroteka',
  'type' => 'pdf',
  'id' => $name,
  'pipeline' => 'hemeroteka',
  'body' => [
      'data' => $base64,
      'publi' => $publi,
      'sek' => $sek,
  ]
];
$response = $client->index($params);

```

What do you think is happening?

Thanks,

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 6, 2019, 9:57am UTC](https://discuss.elastic.co/t/elasticsearch-php-error-indexing-documents/167256/2 "2019-03-06T09:57:47Z")

</div>

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