mailerlite / laravel-elasticsearch

An easy way to use the official Elastic Search client in your Laravel applications.
MIT License
916 stars 187 forks source link

How to refresh after index #127

Closed thewasta closed 2 years ago

thewasta commented 3 years ago

Laravel version: 5.8 ElasticSearch version: 6.6

When I use search right after index, this return a empty array of hits, example:

$client->index([
  "index" => "testing",
  "type" => "_doc",
  "body" => [
    "name" => "Michael"
  ]
]);

$search = $client->search([
  "index" => "testing",
  "type" => "_doc",
  "body" => [
  "query" => [
    "match" => [
      "name" => "Michael"
      ]
    ]
  ]
]);

But if I search again it return hits

cviebrock commented 2 years ago

It looks like you have a question about how to do something with the Elasticsearch client in your Laravel application, or are having issues connecting to your Elastic instance.

Please refer to the official documentation for information on how to use the Elasticsearch client. My package is simply a wrapper around the official client that makes it easier to configure your ES connection in a more Laravel-friendly way. The package doesn't provide any functionality apart from setting up the configuration.