L
L
lolrofl012019-01-05 12:12:36
elasticsearch
lolrofl01, 2019-01-05 12:12:36

How to connect elasticsearch to laravel for database search?

Does elasticsearch allow you to search the database at all? Some terribly meager documentation on elastic. For example:

$params = [
    'index' => 'my_index',
    'type' => 'my_type',
    'id' => 'my_id',
    'body' => ['testField' => 'abc']
];

Here's what to write in the index, type, and so on? On my example. There is a table authors, it lists the names of the authors (column name). I wrote something like this:
$data = [
            'body' => [
                '_all' => 'леонид'
            ],
            'index' => 'leagues',
            'type' => 'name'
        ];


        dd($client->index($data));

I get the error No alive nodes found in your cluster.
I didn’t find a connection to the database anywhere, the only thing I saw was this description in the documentation:
After you publish the configuration file as suggested above, you may configure ElasticSearch by adding the following to your application's .env file (with appropriate values):

ELASTICSEARCH_HOST=localhost
ELASTICSEARCH_PORT=9200
ELASTICSEARCH_SCHEME=http
ELASTICSEARCH_USER=
ELASTICSEARCH_PASS=

And what to write here is not said. Can accesses from a DB bring here? Or what? How in general it is possible to force to search in the necessary table in a DB?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Shumov, 2019-01-05
@lolrofl01

Elastic is not a database and there are no tables. Well, so that you are completely in shock.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question