News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

VG Tech Blog:
Using Elastica to Query ElasticSearch
July 03, 2012 @ 08:55:10

On the VG Tech blog today there's a new post by Christer Edvartsen about using the Elastica PHP Elastic Search client to do more than just pull information out of the data source. He dug into the source of the tool itself and figured out a way to perform actual queries.

The last couple of months I have been playing around with elasticsearch, an open source, distributed, RESTful search engine built on top of Apache Lucene. To interact with elasticsearch in PHP I have been using a client called Elastica. This was all fun and games until I needed to do actual queries, which is what our users will be doing most of the time. Elastica's documentation does not (yet) say anything about how to search using the client, so I needed to dig through the code to see if I could find some solutions.

He includes a sample mapping structure and shows how to take both a simple, single-term query and turn it into a request and how to make a more complex request with filters, facets, sorting and a few other things thrown in. He also shows how you can manually create a query (define the JSON structure yourself) and push that into the "query builder" for handling.

0 comments voice your opinion now!
elastica elasticsearch query tutorial


blog comments powered by Disqus

Similar Posts

PHPMaster.com: Sending Emails with PHP

PHP-Coding-Practices.com: Composing Methods: Split Temporary Variable

Chris Hartjes' Blog: Tutorial: How to create a thread in vBulletin with a script

PHPMac.com: Building and Installing Apache 2.2.2 and PHP 5.1.3 (or 5.1.4) on Mac OS X 10.4.6

PHPBuilder.com: Compose a MVC Paradigm for PHP with Symfony


Community Events





Don't see your event here?
Let us know!


interview package framework podcast symfony introduction opinion bugfix api install voicesoftheelephpant laravel release series list deployment language library tips community

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework