Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
John Peter
search('')->get() returns empty where as search('')->raw() returns the elasticsearch response, please help
John Peter
  • search('*')
Wojciech Szczurek
@johnpeter.pondybiz_gitlab This is a bug, produces this error Method ScoutElastic\Builders\FilterBuilder::rule does not exist.
how to log query record :((
Wojciech Szczurek
@NominationP Privide logger in Elasticsearch config. ``
 * @param \Psr\Log\LoggerInterface $logger
 * @return $this
public function setLogger($logger)
    if (!$logger instanceof LoggerInterface) {
        throw new InvalidArgumentException('$logger must implement \Psr\Log\LoggerInterface!');

    $this->logger = $logger;

    return $this;
Halah AlMazrua
hello, I have a simple question, can I elasticsearch to 2 models ?
I'm new to elasticsearch, please excuse me
Zac Grierson
They guys new to setting this up was wondering if anyone could help me get the basics done?
arun nair

Hi I m newer in elastic search .. I got an error D:\xampp\htdocs\laraelastic>php artisan elastic:update-mapping "App\Book"

Elasticsearch\Common\Exceptions\BadRequest400Exception : {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Rejecting mapping update to [tutorial] as the final mapping would have more than 1 type: [authors, books]"}],"type":"illegal_argument_exception","reason":"Rejecting mapping update to [tutorial] as the final mapping would have more than 1 type: [authors, books]"},"status":400}

at D:\xampp\htdocs\laraelastic\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Connections\Connection.php:624
620| $exception = new ScriptLangNotSupportedException($responseBody. $statusCode);
621| } elseif ($statusCode === 408) {
622| $exception = new RequestTimeout408Exception($responseBody, $statusCode);
623| } else {

624| $exception = new BadRequest400Exception($responseBody, $statusCode);
625| }
627| $this->logRequestFail($request, $response, $exception);

Exception trace:

1 Elasticsearch\Connections\Connection::process4xxError([])

2 Elasticsearch\Connections\Connection::Elasticsearch\Connections{closure}()

Please use the argument -v to see more details.

Book Model <?php

namespace App;
use ScoutElastic\Searchable;
use Illuminate\Database\Eloquent\Model;

class Book extends Model
use Searchable;

// We don't want to use timestamps in this tutorial
public $timestamps = false;
protected $indexConfigurator = TutorialIndexConfigurator::class;

// We don't analyze numbers, all text is in English
protected $mapping = [
'properties' => [
'id' => [
'type' => 'integer',
'index' => true
'title' => [
'type' => 'text',
'analyzer' => 'english'
'description' => [
'type' => 'text',
'analyzer' => 'english'
'year' => [
'type' => 'integer',
'index' => false
'author_id' => [
'type' => 'integer',
'index' => true
// Each book belongs to one author
public function author()
return $this->belongsTo(Author::class);

Evgeni Enchev

Hi all. I have the following issue:

  1. Standard laravel model with $mapping attribute, where the created_at field is set as ['type' => 'date','format' => 'yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis||date_optional_time']
  2. Next, I create an Index for that model:
    php artisan elastic:create-index --tenant=$domain App\Search\IndexConfigurators\ModelIndexConfigurator

However, until any data is imported into the index it's mapping, despite defined in the code, is not applied. This I verify in ES by accessing ES_URL/{index}/_mapping

Because of this, if I try any search with empty ElasticSearch index, I get the following:
query_shard_exception\",\"reason\":\"No mapping found for [created_at] in order to sort on\",\"index_uuid\":\"NFCAQ2oJTjqOjjtjEpQOSQ\",\"index\":\"INDEX_NAME\"}],\"type\":\"search_phase_execution_exception\"
Any idea how to apply index mapping at index creation and not first import?

Failed to execute git checkout '59cf9c8b9262ea81e097a7ab7483a17332c8ac21' -- && git reset --hard '59cf9c8b9262ea81e097a7ab7483a17332c8ac21' --

fatal: reference is not a tree: 59cf9c8b9262ea81e097a7ab7483a17332c8ac21

return this, why?
when i try compoer install
Utsav Shrestha
hello what is the difference between this package and https://github.com/elasticquent/Elasticquent
Fredrik Sundström

Hey! :)

If any authors are here, thanks for a good lib! It works really good for me.

I have a task I do not know how to complete. Tried googling it but I'm turning up nothing I can make sense of... Yes, I'm a beginner, sort of. :)

Anyway, I'm trying to use whereIn for recipe ingredients:

->whereIn('ingredients', $ingredients)

Where $ingredients obviously is an array, also, the field in the index is an array. Kinda like this:

->whereIn(['tomatoes', 'potatoes', 'cucumbers'], ['tomatoes', 'potatoes'])

I would like it to match all the ingredients in the array, tho. Now it'll show me results if one of the ingredients in the array matches anything in the array in the index, but I would like to force it to only show records that has all the ingredients I pass to it, in this example it has to have both tomatoes and potatoes.

Does anyone know how I can achieve this?

is this still support with laravel 6.5
Santosh Jung Shahi
can anyone help me in this issue?
Santosh Jung Shahi
Hi! I am currently migrating from Elasticquent (abandoned) to the bebenkoivan/scout-elasicsearch-driver.
I have a number of models that have relations of type "hasMany". For example a classified ad model can have any number of categories (just an example) associated with it, for which I use the Eloquent hasMany feature. I am not sure how to get this to work with this package. Any pointers on this?
Or would I be better off indexing the entire classified ad with all its child objects in a single document?... this would require a large rewrite of the code so this is not preferred..
I should note that the user has to be able to filter on the child models of the main object (classified ad)
Looks like this matches my usecase: babenkoivan/scout-elasticsearch-driver#91
will investigate further
Andrey Toropin
@babenkoivan Hello again! According to new ES breaking changes (https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html) like removal the ability to store several types in one index (ex. several tables from DB in one ES index), I'm looking for the best way to search across multiple types. Obvious option is: multi index search. But, as far as I know, your current extension version could not make multi index search request? And so, it cannot map results from DB source, because of _type. Any suggestions? Thank you!
@babenkoivan, merge this please, babenkoivan/scout-elasticsearch-driver#307
Rodrigo Galter
Bom dia pessoal, como faço pra usar a busca junto com ->whereHas() ?
Hi, recently started using this package for my site. I have about million records to index and I am using LengthAwarePaginator, but the thing is - I can set after search(... to ->take(Product::RESULT_LIMIT) (which is 600, in this case) and paginating it 24 records per page, but it always returns max_result_window ES setting which is, as default, 10000, yet, it I don't paginate it with Laravel, it returns the amount of ES indices I need (600). As I have read, you should use "size" to define the limit, but it is used with Laravel LApaginator which then messed it up and I have to end up putting dynamic numbers for "from" and "size" in the query, which defeats the purpose.
Any other way to set limited amount of returned indices from Elastic? Without the limit I get the error of "from + size is greater than the max_result_window...".
Thanks in advance

I want to use this package with my laravel nova site, but i can't figure out how to make it work ..
I followed the steps in README.md but I get no results when I search (using the nova search bar)

Can anyone help me please

Hello everyone.
I have a new force feedback steering wheel now
but there is no driver for it, so I want to develop a driver for it
please give me any idea, kindly~~~
Elasticsearch/Common/Exceptions/BadRequest400Exception with message '{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Rejecting mapping update to [dani_index] as the final mapping would have more than 1 type: [model_tests, dani_test]"}],"type":"illegal_argument_exception","reason":"Rejecting mapping update to [dani_index] as the final mapping would have more than 1 type: [model_tests, dani_test]"},"status":400}'
i have this error when i try insert fake data with factory
@babenkoivan please help
hello, everyone.
Does anyone know how to do an orWhere() statement?
with scout
when i run elasticsearch in the mac
my java version is 14
is fail
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Invalid -Xlog option '-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m', see error log for details.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
at org.elasticsearch.tools.launchers.JvmErgonomics.flagsFinal(JvmErgonomics.java:123)
at org.elasticsearch.tools.launchers.JvmErgonomics.finalJvmOptions(JvmErgonomics.java:88)
at org.elasticsearch.tools.launchers.JvmErgonomics.choose(JvmErgonomics.java:59)
at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:95)
Aldi Febriansyah
Good day sir! First, I'd like to thanks you for creating this great package @babenkoivan . I'd like to ask, how can i set up authentication to every request to my elastic server?
Is there any way to do that in this package?