# Elastica - PHP client for elasticsearch

**URL:** <https://discuss.elastic.co/t/elastica-php-client-for-elasticsearch/3461>\
**Category:** Elasticsearch\
**Created:** [October 20, 2010, 11:49am UTC](https://discuss.elastic.co/t/elastica-php-client-for-elasticsearch/3461 "2010-10-20T11:49:17Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ruflin\_2](https://avatars.discourse-cdn.com/v4/letter/r/a8b319/32.png) [@ruflin\_2](https://discuss.elastic.co/u/ruflin_2)\
**Post date:** [October 20, 2010, 11:49am UTC](https://discuss.elastic.co/t/elastica-php-client-for-elasticsearch/3461/1 "2010-10-20T11:49:17Z")

</div>

Hi

I published my PHP client for elasticsearch named Elastica to github.  
The client is still in development but it I'm already using it in two  
installations. The difference to the PHP client from nervetattoo is  
that it integrates easily with Zend Framework. Some examples how to  
use the client can be found in the tests (more are coming).

The client can be found here:

> **[ruflin/Elastica](https://github.com/ruflin/Elastica)**
>
> Elastica is a PHP client for elasticsearch

Feedback and suggestions are always welcome.

Nicolas

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [October 20, 2010, 12:04pm UTC](https://discuss.elastic.co/t/elastica-php-client-for-elasticsearch/3461/2 "2010-10-20T12:04:02Z")

</div>

Great!, added it here: [http://www.elasticsearch.com/products/](http://www.elasticsearch.com/products/) (should be up  
soon).

On Wed, Oct 20, 2010 at 1:49 PM, ruflin [ruflin@gmail.com](mailto:ruflin@gmail.com) wrote:

> Hi
> 
> I published my PHP client for elasticsearch named Elastica to github.  
> The client is still in development but it I'm already using it in two  
> installations. The difference to the PHP client from nervetattoo is  
> that it integrates easily with Zend Framework. Some examples how to  
> use the client can be found in the tests (more are coming).
> 
> The client can be found here:  
> [GitHub - ruflin/Elastica: Elastica is a PHP client for elasticsearch](http://github.com/ruflin/Elastica)
> 
> Feedback and suggestions are always welcome.
> 
> Nicolas

---

<div class="post-metadata">

**Author:** ![ruflin\_2](https://avatars.discourse-cdn.com/v4/letter/r/a8b319/32.png) [@ruflin\_2](https://discuss.elastic.co/u/ruflin_2)\
**Post date:** [November 25, 2010, 9:40pm UTC](https://discuss.elastic.co/t/elastica-php-client-for-elasticsearch/3461/3 "2010-11-25T21:40:30Z")

</div>

I just created tag v0.1 [GitHub - ruflin/Elastica at v0.1](https://github.com/ruflin/Elastica/tree/v0.1)  
So now everyone is able to download a specific version and I can start  
to break things again 😉

On Oct 20, 1:04 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Great!, added it here:[http://www.elasticsearch.com/products/](http://www.elasticsearch.com/products/)(should be up  
> soon).
> 
> On Wed, Oct 20, 2010 at 1:49 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> 
> > Hi
> 
> > I published my PHP client for elasticsearch named Elastica to github.  
> > The client is still in development but it I'm already using it in two  
> > installations. The difference to the PHP client from nervetattoo is  
> > that it integrates easily with Zend Framework. Some examples how to  
> > use the client can be found in the tests (more are coming).
> 
> > The client can be found here:  
> > [GitHub - ruflin/Elastica: Elastica is a PHP client for elasticsearch](http://github.com/ruflin/Elastica)
> 
> > Feedback and suggestions are always welcome.
> 
> > Nicolas

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [November 25, 2010, 9:48pm UTC](https://discuss.elastic.co/t/elastica-php-client-for-elasticsearch/3461/4 "2010-11-25T21:48:47Z")

</div>

Looks great!. One question based on the example, I don't see how bulk  
operation supports also deletes?

-shay.banon

On Thu, Nov 25, 2010 at 11:40 PM, ruflin [ruflin@gmail.com](mailto:ruflin@gmail.com) wrote:

> I just created tag v0.1 [GitHub - ruflin/Elastica at v0.1](https://github.com/ruflin/Elastica/tree/v0.1)  
> So now everyone is able to download a specific version and I can start  
> to break things again 😉
> 
> On Oct 20, 1:04 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > Great!, added it here:[Drive results that matter on the Elasticsearch Platform | Elastic](http://www.elasticsearch.com/products/)(should be  
> > up  
> > soon).
> > 
> > On Wed, Oct 20, 2010 at 1:49 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> > 
> > > Hi
> > 
> > > I published my PHP client for elasticsearch named Elastica to github.  
> > > The client is still in development but it I'm already using it in two  
> > > installations. The difference to the PHP client from nervetattoo is  
> > > that it integrates easily with Zend Framework. Some examples how to  
> > > use the client can be found in the tests (more are coming).
> > 
> > > The client can be found here:  
> > > [GitHub - ruflin/Elastica: Elastica is a PHP client for elasticsearch](http://github.com/ruflin/Elastica)
> > 
> > > Feedback and suggestions are always welcome.
> > 
> > > Nicolas

---

<div class="post-metadata">

**Author:** ![ruflin\_2](https://avatars.discourse-cdn.com/v4/letter/r/a8b319/32.png) [@ruflin\_2](https://discuss.elastic.co/u/ruflin_2)\
**Post date:** [November 27, 2010, 11:15am UTC](https://discuss.elastic.co/t/elastica-php-client-for-elasticsearch/3461/5 "2010-11-27T11:15:22Z")

</div>

Bulk deleting can be done with the following code (based on the ids)

```
/**
 * Deletes documents with the given ids, index, type from the index
 *
 * @link http://www.elasticsearch.com/docs/elasticsearch/rest_api/bulk/
 * @param array $ids Document ids
 * @param string $index Index name
 * @param string $type Type of documents
 * @return Elastica_Response Response object
 * @throws Elastica_Exception If ids is empty
 */
public function deleteIds(array $ids, $index, $type) {

```

An example would be:  
$client-\>deleteIds(array(1, 7, 9), 'xodoa', 'user');

I will add that to the example with the next commit.

Thanks for pointing that out.

On Nov 25, 10:48 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Looks great!. One question based on the example, I don't see how bulk  
> operation supports also deletes?
> 
> -shay.banon
> 
> On Thu, Nov 25, 2010 at 11:40 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> 
> > I just created tag v0.1https://github.com/ruflin/Elastica/tree/v0.1  
> > So now everyone is able to download a specific version and I can start  
> > to break things again 😉
> 
> > On Oct 20, 1:04 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > 
> > > Great!, added it here:[http://www.elasticsearch.com/products/](http://www.elasticsearch.com/products/)(shouldbe  
> > > up  
> > > soon).
> 
> > > On Wed, Oct 20, 2010 at 1:49 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> > > 
> > > > Hi
> 
> > > > I published my PHP client for elasticsearch named Elastica to github.  
> > > > The client is still in development but it I'm already using it in two  
> > > > installations. The difference to the PHP client from nervetattoo is  
> > > > that it integrates easily with Zend Framework. Some examples how to  
> > > > use the client can be found in the tests (more are coming).
> 
> > > > The client can be found here:  
> > > > [GitHub - ruflin/Elastica: Elastica is a PHP client for elasticsearch](http://github.com/ruflin/Elastica)
> 
> > > > Feedback and suggestions are always welcome.
> 
> > > > Nicolas

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [November 27, 2010, 3:27pm UTC](https://discuss.elastic.co/t/elastica-php-client-for-elasticsearch/3461/6 "2010-11-27T15:27:01Z")

</div>

Nice. But, its still missing the capability in the bulk API to have both  
index and delete operations, on different indices and types. Maybe add it as  
an API on the Client?

On Sat, Nov 27, 2010 at 1:15 PM, ruflin [ruflin@gmail.com](mailto:ruflin@gmail.com) wrote:

> Bulk deleting can be done with the following code (based on the ids)
> 
> ```
> /**
> * Deletes documents with the given ids, index, type from the index
> *
> * @link
> 
> ```
> 
> [http://www.elasticsearch.com/docs/elasticsearch/rest\_api/bulk/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/bulk/)  
> \* @param array $ids Document ids  
> \* @param string $index Index name  
> \* @param string $type Type of documents  
> \* @return Elastica\_Response Response object  
> \* @throws Elastica\_Exception If ids is empty  
> \*/  
> public function deleteIds(array $ids, $index, $type) {
> 
> An example would be:  
> $client-\>deleteIds(array(1, 7, 9), 'xodoa', 'user');
> 
> I will add that to the example with the next commit.
> 
> Thanks for pointing that out.
> 
> On Nov 25, 10:48 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > Looks great!. One question based on the example, I don't see how bulk  
> > operation supports also deletes?
> > 
> > -shay.banon
> > 
> > On Thu, Nov 25, 2010 at 11:40 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> > 
> > > I just created tag v0.1https://github.com/ruflin/Elastica/tree/v0.1  
> > > So now everyone is able to download a specific version and I can start  
> > > to break things again 😉
> > 
> > > On Oct 20, 1:04 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > > 
> > > > Great!, added it here:  
> > > > [http://www.elasticsearch.com/products/](http://www.elasticsearch.com/products/)(shouldbe  
> > > > up  
> > > > soon).
> > 
> > > > On Wed, Oct 20, 2010 at 1:49 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> > > > 
> > > > > Hi
> > 
> > > > > I published my PHP client for elasticsearch named Elastica to  
> > > > > github.  
> > > > > The client is still in development but it I'm already using it in  
> > > > > two  
> > > > > installations. The difference to the PHP client from nervetattoo is  
> > > > > that it integrates easily with Zend Framework. Some examples how to  
> > > > > use the client can be found in the tests (more are coming).
> > 
> > > > > The client can be found here:  
> > > > > [GitHub - ruflin/Elastica: Elastica is a PHP client for elasticsearch](http://github.com/ruflin/Elastica)
> > 
> > > > > Feedback and suggestions are always welcome.
> > 
> > > > > Nicolas

---

<div class="post-metadata">

**Author:** ![ruflin\_2](https://avatars.discourse-cdn.com/v4/letter/r/a8b319/32.png) [@ruflin\_2](https://discuss.elastic.co/u/ruflin_2)\
**Post date:** [November 28, 2010, 9:43pm UTC](https://discuss.elastic.co/t/elastica-php-client-for-elasticsearch/3461/7 "2010-11-28T21:43:47Z")

</div>

You're right. This is not possible yet. For the next release I will  
probably add a function

function bulk(array $params);

in the Client object. Like this all params can be directly passed as  
nested array to the function like:

array(  
'delete' =\> array('\_index' =\> 'test', '\_type' =\> 'user', '\_id' =\>  
1),  
'index' =\> array(...

);

This should probably work.

If someone already now wants to use such a function, it is always  
possible to create own calls and call the request method:

return $this-\>request($path, Elastica\_Request::PUT, $query);

On Nov 27, 4:27 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Nice. But, its still missing the capability in the bulk API to have both  
> index and delete operations, on different indices and types. Maybe add it as  
> an API on the Client?
> 
> On Sat, Nov 27, 2010 at 1:15 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> 
> > Bulk deleting can be done with the following code (based on the ids)
> 
> > ```
> > /**
> > * Deletes documents with the given ids, index, type from the index
> > *
> > * @link
> > 
> > ```
> > 
> > [http://www.elasticsearch.com/docs/elasticsearch/rest\_api/bulk/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/bulk/)  
> > \* @param array $ids Document ids  
> > \* @param string $index Index name  
> > \* @param string $type Type of documents  
> > \* @return Elastica\_Response Response object  
> > \* @throws Elastica\_Exception If ids is empty  
> > \*/  
> > public function deleteIds(array $ids, $index, $type) {
> 
> > An example would be:  
> > $client-\>deleteIds(array(1, 7, 9), 'xodoa', 'user');
> 
> > I will add that to the example with the next commit.
> 
> > Thanks for pointing that out.
> 
> > On Nov 25, 10:48 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > 
> > > Looks great!. One question based on the example, I don't see how bulk  
> > > operation supports also deletes?
> 
> > > -shay.banon
> 
> > > On Thu, Nov 25, 2010 at 11:40 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> > > 
> > > > I just created tag v0.1https://github.com/ruflin/Elastica/tree/v0.1  
> > > > So now everyone is able to download a specific version and I can start  
> > > > to break things again 😉
> 
> > > > On Oct 20, 1:04 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > > > 
> > > > > Great!, added it here:  
> > > > > [Drive results that matter on the Elasticsearch Platform | Elastic](http://www.elasticsearch.com/products/)(shouldbe  
> > > > > up  
> > > > > soon).
> 
> > > > > On Wed, Oct 20, 2010 at 1:49 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> > > > > 
> > > > > > Hi
> 
> > > > > > I published my PHP client for elasticsearch named Elastica to  
> > > > > > github.  
> > > > > > The client is still in development but it I'm already using it in  
> > > > > > two  
> > > > > > installations. The difference to the PHP client from nervetattoo is  
> > > > > > that it integrates easily with Zend Framework. Some examples how to  
> > > > > > use the client can be found in the tests (more are coming).
> 
> > > > > > The client can be found here:  
> > > > > > [GitHub - ruflin/Elastica: Elastica is a PHP client for elasticsearch](http://github.com/ruflin/Elastica)
> 
> > > > > > Feedback and suggestions are always welcome.
> 
> > > > > > Nicolas

---

<div class="post-metadata">

**Author:** ![ruflin\_2](https://avatars.discourse-cdn.com/v4/letter/r/a8b319/32.png) [@ruflin\_2](https://discuss.elastic.co/u/ruflin_2)\
**Post date:** [November 28, 2010, 10:04pm UTC](https://discuss.elastic.co/t/elastica-php-client-for-elasticsearch/3461/8 "2010-11-28T22:04:14Z")

</div>

This should resolve the problem:

> <https://github.com/ruflin/Elastica/commit/d1f54b5cab2d1d8130cc69cc10f34dccf6082333>

My example on top was not 100% correct. Please check the code  
documentation for an example.

On Nov 28, 10:43 pm, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:

> You're right. This is not possible yet. For the next release I will  
> probably add a function
> 
> function bulk(array $params);
> 
> in the Client object. Like this all params can be directly passed as  
> nested array to the function like:
> 
> array(  
> 'delete' =\> array('\_index' =\> 'test', '\_type' =\> 'user', '\_id' =\>  
> 1),  
> 'index' =\> array(...
> 
> );
> 
> This should probably work.
> 
> If someone already now wants to use such a function, it is always  
> possible to create own calls and call the request method:
> 
> return $this-\>request($path, Elastica\_Request::PUT, $query);
> 
> On Nov 27, 4:27 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > Nice. But, its still missing the capability in the bulk API to have both  
> > index and delete operations, on different indices and types. Maybe add it as  
> > an API on the Client?
> 
> > On Sat, Nov 27, 2010 at 1:15 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> > 
> > > Bulk deleting can be done with the following code (based on the ids)
> 
> > > ```
> > > /**
> > > * Deletes documents with the given ids, index, type from the index
> > > *
> > > * @link
> > > 
> > > ```
> > > 
> > > [http://www.elasticsearch.com/docs/elasticsearch/rest\_api/bulk/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/bulk/)  
> > > \* @param array $ids Document ids  
> > > \* @param string $index Index name  
> > > \* @param string $type Type of documents  
> > > \* @return Elastica\_Response Response object  
> > > \* @throws Elastica\_Exception If ids is empty  
> > > \*/  
> > > public function deleteIds(array $ids, $index, $type) {
> 
> > > An example would be:  
> > > $client-\>deleteIds(array(1, 7, 9), 'xodoa', 'user');
> 
> > > I will add that to the example with the next commit.
> 
> > > Thanks for pointing that out.
> 
> > > On Nov 25, 10:48 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > > 
> > > > Looks great!. One question based on the example, I don't see how bulk  
> > > > operation supports also deletes?
> 
> > > > -shay.banon
> 
> > > > On Thu, Nov 25, 2010 at 11:40 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> > > > 
> > > > > I just created tag v0.1https://github.com/ruflin/Elastica/tree/v0.1  
> > > > > So now everyone is able to download a specific version and I can start  
> > > > > to break things again 😉
> 
> > > > > On Oct 20, 1:04 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > > > > 
> > > > > > Great!, added it here:  
> > > > > > [http://www.elasticsearch.com/products/](http://www.elasticsearch.com/products/)(shouldbe  
> > > > > > up  
> > > > > > soon).
> 
> > > > > > On Wed, Oct 20, 2010 at 1:49 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> > > > > > 
> > > > > > > Hi
> 
> > > > > > > I published my PHP client for elasticsearch named Elastica to  
> > > > > > > github.  
> > > > > > > The client is still in development but it I'm already using it in  
> > > > > > > two  
> > > > > > > installations. The difference to the PHP client from nervetattoo is  
> > > > > > > that it integrates easily with Zend Framework. Some examples how to  
> > > > > > > use the client can be found in the tests (more are coming).
> 
> > > > > > > The client can be found here:  
> > > > > > > [GitHub - ruflin/Elastica: Elastica is a PHP client for elasticsearch](http://github.com/ruflin/Elastica)
> 
> > > > > > > Feedback and suggestions are always welcome.
> 
> > > > > > > Nicolas

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [November 28, 2010, 10:15pm UTC](https://discuss.elastic.co/t/elastica-php-client-for-elasticsearch/3461/9 "2010-11-28T22:15:51Z")

</div>

Great!, the ability to have index and delete mixed (and ordered) in the same  
bulk request is important, great that you enabled it. Note that the type in  
the index payload is optional (you don't have to provide the type as the top  
level json object), maybe it make sense to doc it.

On Mon, Nov 29, 2010 at 12:04 AM, ruflin [ruflin@gmail.com](mailto:ruflin@gmail.com) wrote:

> This should resolve the problem:
> 
> [Bulk method for different operations, index and types: $client-\>bulk(… · ruflin/Elastica@d1f54b5 · GitHub](https://github.com/ruflin/Elastica/commit/d1f54b5cab2d1d8130cc69cc10f34dccf6082333)
> 
> My example on top was not 100% correct. Please check the code  
> documentation for an example.
> 
> On Nov 28, 10:43 pm, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> 
> > You're right. This is not possible yet. For the next release I will  
> > probably add a function
> > 
> > function bulk(array $params);
> > 
> > in the Client object. Like this all params can be directly passed as  
> > nested array to the function like:
> > 
> > array(  
> > 'delete' =\> array('\_index' =\> 'test', '\_type' =\> 'user', '\_id' =\>  
> > 1),  
> > 'index' =\> array(...
> > 
> > );
> > 
> > This should probably work.
> > 
> > If someone already now wants to use such a function, it is always  
> > possible to create own calls and call the request method:
> > 
> > return $this-\>request($path, Elastica\_Request::PUT, $query);
> > 
> > On Nov 27, 4:27 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > 
> > > Nice. But, its still missing the capability in the bulk API to have  
> > > both  
> > > index and delete operations, on different indices and types. Maybe add  
> > > it as  
> > > an API on the Client?
> > 
> > > On Sat, Nov 27, 2010 at 1:15 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> > > 
> > > > Bulk deleting can be done with the following code (based on the ids)
> > 
> > > > ```
> > > > /**
> > > > * Deletes documents with the given ids, index, type from the
> > > > 
> > > > ```
> 
> index
> 
> > > > ```
> > > > *
> > > > * @link
> > > > 
> > > > ```
> > > > 
> > > > [http://www.elasticsearch.com/docs/elasticsearch/rest\_api/bulk/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/bulk/)  
> > > > \* @param array $ids Document ids  
> > > > \* @param string $index Index name  
> > > > \* @param string $type Type of documents  
> > > > \* @return Elastica\_Response Response object  
> > > > \* @throws Elastica\_Exception If ids is empty  
> > > > \*/  
> > > > public function deleteIds(array $ids, $index, $type) {
> > 
> > > > An example would be:  
> > > > $client-\>deleteIds(array(1, 7, 9), 'xodoa', 'user');
> > 
> > > > I will add that to the example with the next commit.
> > 
> > > > Thanks for pointing that out.
> > 
> > > > On Nov 25, 10:48 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com)  
> > > > wrote:
> > > > 
> > > > > Looks great!. One question based on the example, I don't see how  
> > > > > bulk  
> > > > > operation supports also deletes?
> > 
> > > > > -shay.banon
> > 
> > > > > On Thu, Nov 25, 2010 at 11:40 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> > > > > 
> > > > > > I just created tag v0.1  
> > > > > > [GitHub - ruflin/Elastica at v0.1](https://github.com/ruflin/Elastica/tree/v0.1)  
> > > > > > So now everyone is able to download a specific version and I can  
> > > > > > start  
> > > > > > to break things again 😉
> > 
> > > > > > On Oct 20, 1:04 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com)  
> > > > > > wrote:
> > > > > > 
> > > > > > > Great!, added it here:  
> > > > > > > [http://www.elasticsearch.com/products/](http://www.elasticsearch.com/products/)(shouldbe  
> > > > > > > up  
> > > > > > > soon).
> > 
> > > > > > > On Wed, Oct 20, 2010 at 1:49 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com)  
> > > > > > > wrote:
> > > > > > > 
> > > > > > > > Hi
> > 
> > > > > > > > I published my PHP client for elasticsearch named Elastica to  
> > > > > > > > github.  
> > > > > > > > The client is still in development but it I'm already using  
> > > > > > > > it in  
> > > > > > > > two  
> > > > > > > > installations. The difference to the PHP client from  
> > > > > > > > nervetattoo is  
> > > > > > > > that it integrates easily with Zend Framework. Some examples  
> > > > > > > > how to  
> > > > > > > > use the client can be found in the tests (more are coming).
> > 
> > > > > > > > The client can be found here:  
> > > > > > > > [GitHub - ruflin/Elastica: Elastica is a PHP client for elasticsearch](http://github.com/ruflin/Elastica)
> > 
> > > > > > > > Feedback and suggestions are always welcome.
> > 
> > > > > > > > Nicolas

---

<div class="post-metadata">

**Author:** ![ruflin\_2](https://avatars.discourse-cdn.com/v4/letter/r/a8b319/32.png) [@ruflin\_2](https://discuss.elastic.co/u/ruflin_2)\
**Post date:** [November 29, 2010, 12:30pm UTC](https://discuss.elastic.co/t/elastica-php-client-for-elasticsearch/3461/10 "2010-11-29T12:30:21Z")

</div>

Didn't know that. So it takes the type from the previous index  
statement? Will add that to the documentation.

On Nov 28, 11:15 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Great!, the ability to have index and delete mixed (and ordered) in the same  
> bulk request is important, great that you enabled it. Note that the type in  
> the index payload is optional (you don't have to provide the type as the top  
> level json object), maybe it make sense to doc it.
> 
> On Mon, Nov 29, 2010 at 12:04 AM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> 
> > This should resolve the problem:
> 
> > [https://github.com/ruflin/Elastica/commit/d1f54b5cab2d1d8130cc69cc10f](https://github.com/ruflin/Elastica/commit/d1f54b5cab2d1d8130cc69cc10f)...
> 
> > My example on top was not 100% correct. Please check the code  
> > documentation for an example.
> 
> > On Nov 28, 10:43 pm, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> > 
> > > You're right. This is not possible yet. For the next release I will  
> > > probably add a function
> 
> > > function bulk(array $params);
> 
> > > in the Client object. Like this all params can be directly passed as  
> > > nested array to the function like:
> 
> > > array(  
> > > 'delete' =\> array('\_index' =\> 'test', '\_type' =\> 'user', '\_id' =\>  
> > > 1),  
> > > 'index' =\> array(...
> 
> > > );
> 
> > > This should probably work.
> 
> > > If someone already now wants to use such a function, it is always  
> > > possible to create own calls and call the request method:
> 
> > > return $this-\>request($path, Elastica\_Request::PUT, $query);
> 
> > > On Nov 27, 4:27 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > > > Nice. But, its still missing the capability in the bulk API to have  
> > > > both  
> > > > index and delete operations, on different indices and types. Maybe add  
> > > > it as  
> > > > an API on the Client?
> 
> > > > On Sat, Nov 27, 2010 at 1:15 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> > > > 
> > > > > Bulk deleting can be done with the following code (based on the ids)
> 
> > > > > ```
> > > > > /**
> > > > > * Deletes documents with the given ids, index, type from the
> > > > > 
> > > > > ```
> > 
> > index
> > 
> > > > > ```
> > > > > *
> > > > > * @link
> > > > > 
> > > > > ```
> > > > > 
> > > > > [http://www.elasticsearch.com/docs/elasticsearch/rest\_api/bulk/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/bulk/)  
> > > > > \* @param array $ids Document ids  
> > > > > \* @param string $index Index name  
> > > > > \* @param string $type Type of documents  
> > > > > \* @return Elastica\_Response Response object  
> > > > > \* @throws Elastica\_Exception If ids is empty  
> > > > > \*/  
> > > > > public function deleteIds(array $ids, $index, $type) {
> 
> > > > > An example would be:  
> > > > > $client-\>deleteIds(array(1, 7, 9), 'xodoa', 'user');
> 
> > > > > I will add that to the example with the next commit.
> 
> > > > > Thanks for pointing that out.
> 
> > > > > On Nov 25, 10:48 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com)  
> > > > > wrote:
> > > > > 
> > > > > > Looks great!. One question based on the example, I don't see how  
> > > > > > bulk  
> > > > > > operation supports also deletes?
> 
> > > > > > -shay.banon
> 
> > > > > > On Thu, Nov 25, 2010 at 11:40 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> > > > > > 
> > > > > > > I just created tag v0.1  
> > > > > > > [GitHub - ruflin/Elastica at v0.1](https://github.com/ruflin/Elastica/tree/v0.1)  
> > > > > > > So now everyone is able to download a specific version and I can  
> > > > > > > start  
> > > > > > > to break things again 😉
> 
> > > > > > > On Oct 20, 1:04 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com)  
> > > > > > > wrote:
> > > > > > > 
> > > > > > > > Great!, added it here:  
> > > > > > > > [http://www.elasticsearch.com/products/](http://www.elasticsearch.com/products/)(shouldbe  
> > > > > > > > up  
> > > > > > > > soon).
> 
> > > > > > > > On Wed, Oct 20, 2010 at 1:49 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com)  
> > > > > > > > wrote:
> > > > > > > > 
> > > > > > > > > Hi
> 
> > > > > > > > > I published my PHP client for elasticsearch named Elastica to  
> > > > > > > > > github.  
> > > > > > > > > The client is still in development but it I'm already using  
> > > > > > > > > it in  
> > > > > > > > > two  
> > > > > > > > > installations. The difference to the PHP client from  
> > > > > > > > > nervetattoo is  
> > > > > > > > > that it integrates easily with Zend Framework. Some examples  
> > > > > > > > > how to  
> > > > > > > > > use the client can be found in the tests (more are coming).
> 
> > > > > > > > > The client can be found here:  
> > > > > > > > > [GitHub - ruflin/Elastica: Elastica is a PHP client for elasticsearch](http://github.com/ruflin/Elastica)
> 
> > > > > > > > > Feedback and suggestions are always welcome.
> 
> > > > > > > > > Nicolas

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [November 29, 2010, 12:36pm UTC](https://discuss.elastic.co/t/elastica-php-client-for-elasticsearch/3461/11 "2010-11-29T12:36:17Z")

</div>

Yes, its the same thing in the index API as well.

On Mon, Nov 29, 2010 at 2:30 PM, ruflin [ruflin@gmail.com](mailto:ruflin@gmail.com) wrote:

> Didn't know that. So it takes the type from the previous index  
> statement? Will add that to the documentation.
> 
> On Nov 28, 11:15 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > Great!, the ability to have index and delete mixed (and ordered) in the  
> > same  
> > bulk request is important, great that you enabled it. Note that the type  
> > in  
> > the index payload is optional (you don't have to provide the type as the  
> > top  
> > level json object), maybe it make sense to doc it.
> > 
> > On Mon, Nov 29, 2010 at 12:04 AM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> > 
> > > This should resolve the problem:
> > 
> > > [Bulk method for different operations, index and types: $client-\>bulk(… · ruflin/Elastica@d1f54b5 · GitHub](https://github.com/ruflin/Elastica/commit/d1f54b5cab2d1d8130cc69cc10f).  
> > > ..
> > 
> > > My example on top was not 100% correct. Please check the code  
> > > documentation for an example.
> > 
> > > On Nov 28, 10:43 pm, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> > > 
> > > > You're right. This is not possible yet. For the next release I will  
> > > > probably add a function
> > 
> > > > function bulk(array $params);
> > 
> > > > in the Client object. Like this all params can be directly passed as  
> > > > nested array to the function like:
> > 
> > > > array(  
> > > > 'delete' =\> array('\_index' =\> 'test', '\_type' =\> 'user', '\_id' =\>  
> > > > 1),  
> > > > 'index' =\> array(...
> > 
> > > > );
> > 
> > > > This should probably work.
> > 
> > > > If someone already now wants to use such a function, it is always  
> > > > possible to create own calls and call the request method:
> > 
> > > > return $this-\>request($path, Elastica\_Request::PUT, $query);
> > 
> > > > On Nov 27, 4:27 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > 
> > > > > Nice. But, its still missing the capability in the bulk API to have  
> > > > > both  
> > > > > index and delete operations, on different indices and types. Maybe  
> > > > > add  
> > > > > it as  
> > > > > an API on the Client?
> > 
> > > > > On Sat, Nov 27, 2010 at 1:15 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com) wrote:
> > > > > 
> > > > > > Bulk deleting can be done with the following code (based on the  
> > > > > > ids)
> > 
> > > > > > ```
> > > > > > /**
> > > > > > * Deletes documents with the given ids, index, type from
> > > > > > 
> > > > > > ```
> 
> the
> 
> > > index
> > > 
> > > > > > ```
> > > > > > *
> > > > > > * @link
> > > > > > 
> > > > > > ```
> > > > > > 
> > > > > > [http://www.elasticsearch.com/docs/elasticsearch/rest\_api/bulk/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/bulk/)  
> > > > > > \* @param array $ids Document ids  
> > > > > > \* @param string $index Index name  
> > > > > > \* @param string $type Type of documents  
> > > > > > \* @return Elastica\_Response Response object  
> > > > > > \* @throws Elastica\_Exception If ids is empty  
> > > > > > \*/  
> > > > > > public function deleteIds(array $ids, $index, $type) {
> > 
> > > > > > An example would be:  
> > > > > > $client-\>deleteIds(array(1, 7, 9), 'xodoa', 'user');
> > 
> > > > > > I will add that to the example with the next commit.
> > 
> > > > > > Thanks for pointing that out.
> > 
> > > > > > On Nov 25, 10:48 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com)  
> > > > > > wrote:
> > > > > > 
> > > > > > > Looks great!. One question based on the example, I don't see  
> > > > > > > how  
> > > > > > > bulk  
> > > > > > > operation supports also deletes?
> > 
> > > > > > > -shay.banon
> > 
> > > > > > > On Thu, Nov 25, 2010 at 11:40 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com)  
> > > > > > > wrote:
> > > > > > > 
> > > > > > > > I just created tag v0.1  
> > > > > > > > [GitHub - ruflin/Elastica at v0.1](https://github.com/ruflin/Elastica/tree/v0.1)  
> > > > > > > > So now everyone is able to download a specific version and I  
> > > > > > > > can  
> > > > > > > > start  
> > > > > > > > to break things again 😉
> > 
> > > > > > > > On Oct 20, 1:04 pm, Shay Banon \<[shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com)
> > 
> > > wrote:
> > > 
> > > > > > > > > Great!, added it here:  
> > > > > > > > > [http://www.elasticsearch.com/products/](http://www.elasticsearch.com/products/)(shouldbe  
> > > > > > > > > up  
> > > > > > > > > soon).
> > 
> > > > > > > > > On Wed, Oct 20, 2010 at 1:49 PM, ruflin [ruf...@gmail.com](mailto:ruf...@gmail.com)  
> > > > > > > > > wrote:
> > > > > > > > > 
> > > > > > > > > > Hi
> > 
> > > > > > > > > > I published my PHP client for elasticsearch named  
> > > > > > > > > > Elastica to  
> > > > > > > > > > github.  
> > > > > > > > > > The client is still in development but it I'm already  
> > > > > > > > > > using  
> > > > > > > > > > it in  
> > > > > > > > > > two  
> > > > > > > > > > installations. The difference to the PHP client from  
> > > > > > > > > > nervetattoo is  
> > > > > > > > > > that it integrates easily with Zend Framework. Some  
> > > > > > > > > > examples  
> > > > > > > > > > how to  
> > > > > > > > > > use the client can be found in the tests (more are  
> > > > > > > > > > coming).
> > 
> > > > > > > > > > The client can be found here:  
> > > > > > > > > > [GitHub - ruflin/Elastica: Elastica is a PHP client for elasticsearch](http://github.com/ruflin/Elastica)
> > 
> > > > > > > > > > Feedback and suggestions are always welcome.
> > 
> > > > > > > > > > Nicolas

---

<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:** [July 6, 2017, 4:16am UTC](https://discuss.elastic.co/t/elastica-php-client-for-elasticsearch/3461/12 "2017-07-06T04:16:02Z")

</div>


