Description of completed work:
1. Elasticsearch and related plug-ins have been installed on the local windows machine.
2. Then install the elasticsearch-php client in laravel.
3. Wrote a SearchController as follows:
<code><?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Requests; class SearchController extends Controller { protected $client; public function __construct() { $this->client = \Elasticsearch\ClientBuilder::create()->build(); } public function index() { $params = [ 'index' => 'node', 'type' => 'article', 'body' => [ 'query' => [ 'match_all' => [] ] ] ]; $response = $this->client->search($params); print_r($response); } public function create() { $params = [ 'index' => 'node', 'type' => 'article', 'id' => '1029', 'body' => [ 'query' => [ 'match_all' => [] ] ] ]; $response = $this->client->index($params); print_r($response); } public function store(Request $request) { } public function show($id) { } public function edit($id) { } public function update(Request $request, $id) { } public function destroy($id) { } } </code>
Problem description:
1. Although I have completed the above 3 steps, I have no clue now and I can’t see any steps in the document. The specific performance is: If I want to index and query a data table named articles
now, what else do I need to do? It's best to explain how to do each step. Thanks.
2. What do 'index', 'type' and 'body' mean?
3. If you don’t use mysql and use ES to save the index directly, what directory is the index file in by default?
Description of completed work:
1. Elasticsearch and related plug-ins have been installed on the local windows machine.
2. Then install the elasticsearch-php client in laravel.
3. Wrote a SearchController as follows:
<code><?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Requests; class SearchController extends Controller { protected $client; public function __construct() { $this->client = \Elasticsearch\ClientBuilder::create()->build(); } public function index() { $params = [ 'index' => 'node', 'type' => 'article', 'body' => [ 'query' => [ 'match_all' => [] ] ] ]; $response = $this->client->search($params); print_r($response); } public function create() { $params = [ 'index' => 'node', 'type' => 'article', 'id' => '1029', 'body' => [ 'query' => [ 'match_all' => [] ] ] ]; $response = $this->client->index($params); print_r($response); } public function store(Request $request) { } public function show($id) { } public function edit($id) { } public function update(Request $request, $id) { } public function destroy($id) { } } </code>
Problem description:
1. Although I have completed the above 3 steps, I have no clue now and I can’t see any steps in the document. The specific performance is: If I want to index and query a data table named articles
now, what else do I need to do? It's best to explain how to do each step. Thanks.
2. What do 'index', 'type' and 'body' mean?
3. If you don’t use mysql and use ES to save the index directly, what directory is the index file in by default?
I have just come into contact with es recently
es can correspond to a mysql database
The concept of index is equivalent to a library
The concept of type is equivalent to a table
Document is equivalent to a record
Then if you want to operate, you must first have a library and a table before you can add, delete, check and modify
How to index and search documents
Index files are stored as files under ES_HOME/data
You can go to the official website to find the jdbc plug-in for logstash, jdbc official documentation