Elastica - PHP client for elasticsearch

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:

Feedback and suggestions are always welcome.

Nicolas

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

On Wed, Oct 20, 2010 at 1:49 PM, ruflin 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

Feedback and suggestions are always welcome.

Nicolas

I just created tag v0.1 GitHub - ruflin/Elastica at v0.1
So now everyone is able to download a specific version and I can start
to break things again :wink:

On Oct 20, 1:04 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

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

On Wed, Oct 20, 2010 at 1:49 PM, ruflin 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

Feedback and suggestions are always welcome.

Nicolas

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 wrote:

I just created tag v0.1 GitHub - ruflin/Elastica at v0.1
So now everyone is able to download a specific version and I can start
to break things again :wink:

On Oct 20, 1:04 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Great!, added it here:Drive results that matter on the Elasticsearch Platform | Elastic(should be
up
soon).

On Wed, Oct 20, 2010 at 1:49 PM, ruflin 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

Feedback and suggestions are always welcome.

Nicolas

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 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 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 :wink:

On Oct 20, 1:04 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Great!, added it here:http://www.elasticsearch.com/products/(shouldbe
up
soon).

On Wed, Oct 20, 2010 at 1:49 PM, ruflin 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

Feedback and suggestions are always welcome.

Nicolas

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 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/
* @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 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 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 :wink:

On Oct 20, 1:04 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Great!, added it here:
http://www.elasticsearch.com/products/(shouldbe
up
soon).

On Wed, Oct 20, 2010 at 1:49 PM, ruflin 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

Feedback and suggestions are always welcome.

Nicolas

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 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 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/
* @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 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 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 :wink:

On Oct 20, 1:04 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Great!, added it here:
Drive results that matter on the Elasticsearch Platform | Elastic(shouldbe
up
soon).

On Wed, Oct 20, 2010 at 1:49 PM, ruflin 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

Feedback and suggestions are always welcome.

Nicolas

This should resolve the problem:

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 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 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 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/
* @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 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 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 :wink:

On Oct 20, 1:04 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Great!, added it here:
http://www.elasticsearch.com/products/(shouldbe
up
soon).

On Wed, Oct 20, 2010 at 1:49 PM, ruflin 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

Feedback and suggestions are always welcome.

Nicolas

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 wrote:

This should resolve the problem:

Bulk method for different operations, index and types: $client->bulk(… · ruflin/Elastica@d1f54b5 · GitHub

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 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 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 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/
* @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
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 wrote:

I just created tag v0.1
GitHub - ruflin/Elastica at v0.1
So now everyone is able to download a specific version and I can
start
to break things again :wink:

On Oct 20, 1:04 pm, Shay Banon shay.ba...@elasticsearch.com
wrote:

Great!, added it here:
http://www.elasticsearch.com/products/(shouldbe
up
soon).

On Wed, Oct 20, 2010 at 1:49 PM, ruflin 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

Feedback and suggestions are always welcome.

Nicolas

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 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 wrote:

This should resolve the problem:

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 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 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 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/
* @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
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 wrote:

I just created tag v0.1
GitHub - ruflin/Elastica at v0.1
So now everyone is able to download a specific version and I can
start
to break things again :wink:

On Oct 20, 1:04 pm, Shay Banon shay.ba...@elasticsearch.com
wrote:

Great!, added it here:
http://www.elasticsearch.com/products/(shouldbe
up
soon).

On Wed, Oct 20, 2010 at 1:49 PM, ruflin 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

Feedback and suggestions are always welcome.

Nicolas

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

On Mon, Nov 29, 2010 at 2:30 PM, ruflin 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 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 wrote:

This should resolve the problem:

Bulk method for different operations, index and types: $client->bulk(… · ruflin/Elastica@d1f54b5 · GitHub.
..

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 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 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 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/
* @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
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
wrote:

I just created tag v0.1
GitHub - ruflin/Elastica at v0.1
So now everyone is able to download a specific version and I
can
start
to break things again :wink:

On Oct 20, 1:04 pm, Shay Banon <shay.ba...@elasticsearch.com

wrote:

Great!, added it here:
http://www.elasticsearch.com/products/(shouldbe
up
soon).

On Wed, Oct 20, 2010 at 1:49 PM, ruflin 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

Feedback and suggestions are always welcome.

Nicolas