Elasticserach-PHP error

I was trying to workout the example from the below link

Search Engine with PHP & Elasticsearch - YouTube

I cannot index the document (add.php example).

only When I remove the code for the Indexing the html form appears.


require 'vendor/autoload.php';
$es = new Elasticsearch\Client();

if(!empty($_POST)) {
if(isset($_POST['title'],$_POST['body'],$_POST['keywords'])) {
$title = $_POST['title'];
$body = $_POST['body'];
$keywords = explode(',',$_POST['keywords']);
$indexed = $es->index([
'index' => 'articles',
'type' => 'article',
'body' => [
'title' => $title,
'body' => $body,
'keywords' => $keywords

if($indexed) {
<!doctype html>

Add in ES Title



Thanks in Advance

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/71680616-7733-4244-a78e-6342013d2564%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.