pdphilip / laravel-elasticsearch

Laravel Elasticsearch: An Elasticsearch implementation of Laravel's Eloquent ORM
MIT License
86 stars 16 forks source link

[Fixed] All shards failed when using "!=" operator for _id field starting with "-" #13

Closed alirezaImani-f4L3e closed 6 months ago

alirezaImani-f4L3e commented 6 months ago

Hi philip

Bug description

I have a problem using "!=" for comparing _id field with a value that starting with "-" . please give me a solution to this problem .

To Reproduce

For Example :

Audit::where('_id', '!=' , '-t9Z2o0BD6JyEaA0u_qU' )->get();

This code will cause an "query_shard_exception" with reson : "Failed to parse query" .

This _id have been automatically generated by elasticsearch.

pdphilip commented 6 months ago

Hi, which version of the package are you using? Please use the bug template, then I have more info to work with.

I think I know where the issue lies, but will need to update test files for all the maintained packages

pdphilip commented 6 months ago

FYI, if you're still on 2.8 then updating to v2.8.6 will fix this.