Skip to content

Commit

Permalink
[DOCS] add getSource method to the readme (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yassine authored and polyfractal committed Sep 13, 2016
1 parent 8bcf1a8 commit 90cbdfb
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ The recommended method to install _Elasticsearch-PHP_ is through [Composer](http

```php
<?php

use Elasticsearch\ClientBuilder;

require 'vendor/autoload.php';

$client = ClientBuilder::create()->build();
Expand Down Expand Up @@ -170,6 +170,19 @@ Array
)
```

If you want to retrieve the `_source` field directly, there is the `getSource` method:

```php
$params = [
'index' => 'my_index',
'type' => 'my_type',
'id' => 'my_id'
];

$source = $client->getSource($params);
doSomething($source);
```

### Search for a document

Searching is a hallmark of Elasticsearch, so let's perform a search. We are going to use the Match query as a demonstration:
Expand Down

0 comments on commit 90cbdfb

Please sign in to comment.