# Index existing data and integrate elasticsearch with PHP

**URL:** <https://discuss.elastic.co/t/index-existing-data-and-integrate-elasticsearch-with-php/16028>\
**Category:** Elasticsearch\
**Created:** [February 26, 2014, 11:29am UTC](https://discuss.elastic.co/t/index-existing-data-and-integrate-elasticsearch-with-php/16028 "2014-02-26T11:29:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![santosh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/santosh/32/82845_2.png) [@santosh](https://discuss.elastic.co/u/santosh)\
**Post date:** [February 26, 2014, 11:29am UTC](https://discuss.elastic.co/t/index-existing-data-and-integrate-elasticsearch-with-php/16028/1 "2014-02-26T11:29:14Z")

</div>

Dear All,

I have gone through the link -  
[http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/\_quickstart.html](http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/_quickstart.html)  
to understand the setup. Can someone point to the documentation where I can

1. Index existing data from mysql - I can index the data using curl but  
trying to figure out how to do it in one go. Dont want to do through PHP  
since size of data is very large.

2. Sync the data whenever there are any update into the database through  
application. Is there a way to achieve this.

3. How can We use elastic search in PHP

If someone can point to documentation which give some getting started like  
stuff that would be great help.

-Santosh

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/f9ad5f6b-7e4a-4505-920a-20ec2207ab0d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f9ad5f6b-7e4a-4505-920a-20ec2207ab0d%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [February 26, 2014, 12:21pm UTC](https://discuss.elastic.co/t/index-existing-data-and-integrate-elasticsearch-with-php/16028/2 "2014-02-26T12:21:59Z")

</div>

1. There is no way to index straight from MySQL itself. You will need  
some kind of adapter/connector to move the data from MySQL to  
Elasticsearch. This is necessary for several reasons, but mainly because  
you need to transform the rows into usable JSON documents. That's  
something only your application will know how to do. The adapter could be  
written in PHP, Python, Perl, etc...any of your favorite dynamic languages  
will work.

2. Synchronizing databases is another job best left to the application  
and user. The easiest solution is to have a dual-pipeline: when an update  
(or delete or index) arrives at your system, it is sent to MySQL and  
Elasticsearch simultaneously. It is usually easier to perform the  
operation in parallel rather than sending to the database and then trying  
to keep the two synchronized.

3. That's an awfully broad question! 😛 The PHP client quickstart and  
docs show the syntax to use the client, which gives you access to all the  
Elasticsearch APIs. How you want to integrate Elasticsearch into your  
application is entirely up to you, and it is very dependent on your  
particular use-case.

-Zach

On Wednesday, February 26, 2014 6:29:14 AM UTC-5, Santosh wrote:

> Dear All,
> 
> I have gone through the link -  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/_quickstart.htmlto) understand the setup. Can someone point to the documentation where I can
> 
> 1. Index existing data from mysql - I can index the data using curl but  
> trying to figure out how to do it in one go. Dont want to do through PHP  
> since size of data is very large.
> 
> 2. Sync the data whenever there are any update into the database through  
> application. Is there a way to achieve this.
> 
> 3. How can We use Elasticsearch in PHP
> 
> If someone can point to documentation which give some getting started like  
> stuff that would be great help.
> 
> -Santosh

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/8c94a64f-f1fe-463e-9750-71aa7b9836ff%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8c94a64f-f1fe-463e-9750-71aa7b9836ff%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![santosh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/santosh/32/82845_2.png) [@santosh](https://discuss.elastic.co/u/santosh)\
**Post date:** [February 26, 2014, 1:46pm UTC](https://discuss.elastic.co/t/index-existing-data-and-integrate-elasticsearch-with-php/16028/3 "2014-02-26T13:46:01Z")

</div>

Thank you Zach. Your input will definitely helpful.

Santosh  
On 26-Feb-2014 5:52 pm, "Zachary Tong" [zacharyjtong@gmail.com](mailto:zacharyjtong@gmail.com) wrote:

> 1. There is no way to index straight from MySQL itself. You will need  
> some kind of adapter/connector to move the data from MySQL to  
> Elasticsearch. This is necessary for several reasons, but mainly because  
> you need to transform the rows into usable JSON documents. That's  
> something only your application will know how to do. The adapter could be  
> written in PHP, Python, Perl, etc...any of your favorite dynamic languages  
> will work.
> 
> 2. Synchronizing databases is another job best left to the application  
> and user. The easiest solution is to have a dual-pipeline: when an update  
> (or delete or index) arrives at your system, it is sent to MySQL and  
> Elasticsearch simultaneously. It is usually easier to perform the  
> operation in parallel rather than sending to the database and then trying  
> to keep the two synchronized.
> 
> 3. That's an awfully broad question! 😛 The PHP client quickstart  
> and docs show the syntax to use the client, which gives you access to all  
> the Elasticsearch APIs. How you want to integrate Elasticsearch into your  
> application is entirely up to you, and it is very dependent on your  
> particular use-case.
> 
> -Zach
> 
> On Wednesday, February 26, 2014 6:29:14 AM UTC-5, Santosh wrote:
> 
> > Dear All,
> > 
> > I have gone through the link - [http://www.elasticsearch.org/](http://www.elasticsearch.org/)  
> > guide/en/elasticsearch/client/php-api/current/\_quickstart.html to  
> > understand the setup. Can someone point to the documentation where I can
> > 
> > 1. Index existing data from mysql - I can index the data using curl but  
> > trying to figure out how to do it in one go. Dont want to do through PHP  
> > since size of data is very large.
> > 
> > 2. Sync the data whenever there are any update into the database through  
> > application. Is there a way to achieve this.
> > 
> > 3. How can We use Elasticsearch in PHP
> > 
> > If someone can point to documentation which give some getting started  
> > like stuff that would be great help.
> > 
> > -Santosh
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/TKrj5q6w9gs/unsubscribe](https://groups.google.com/d/topic/elasticsearch/TKrj5q6w9gs/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/8c94a64f-f1fe-463e-9750-71aa7b9836ff%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8c94a64f-f1fe-463e-9750-71aa7b9836ff%40googlegroups.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CADO%2BbTENERPrEGsPHbjxUZZQUJDth9S79iZM4X8Vx\_YRErfLWQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CADO%2BbTENERPrEGsPHbjxUZZQUJDth9S79iZM4X8Vx_YRErfLWQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 1:47am UTC](https://discuss.elastic.co/t/index-existing-data-and-integrate-elasticsearch-with-php/16028/4 "2017-07-06T01:47:14Z")

</div>


