<?php
namespace App\Http\Controllers;
use Elasticsearch\Client;
use Illuminate\Http\Request;
class AjaxController extends Controller
{
public function getPage()
{
return view('suggest');
}
private $client;
public function __construct(Client $client)
{
$this->client = $client;
}
public function suggest(Request $request)
{
$data = $request->all();
$params = [
'index' => 'blueocean',
'body' => [
'try' => [
'text' => 'god',
'completion' => [ 'field' => 'Provider' ]
]
]
];
dump($data);
$response = $this->client->search($params);
dump($response);
}
}
I'm getting {"error":{"root_cause":[{"type":"parsing_exception","reason":"Unknown key for a START_OBJECT in [try].","line":1,"col":8}],"type":"parsing_exception","reason":"Unknown key for a START_OBJECT in [try].","line":1,"col":8},"status":400} error.
Why?
Any help?
I don't think try is a valid key (is what the error log is telling you) and the rest of que query does also not look good to me . What are you trying to get ? How your mapping is ?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.