You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 13, 2021. It is now read-only.
New instalation of the latest version of Laravel 8, with one some users in the database.
When running this command: php artisan scout:import "App\Models\User"
The response is:
MeiliSearch\Exceptions\HTTPRequestException
A primary key is already present. It's impossible to update it
at [Project Path]\vendor\meilisearch\meilisearch-php\src\Http\Client.php:182
178▕ private function parseResponse(ResponseInterface $response)
179▕ {
180▕ if ($response->getStatusCode() >= 300) {
181▕ $body = json_decode($response->getBody()->getContents(), true) ?? $response->getReasonPhrase();
➜ 182▕ throw new HTTPRequestException($response->getStatusCode(), $body);
183▕ }
184▕
185▕ return json_decode($response->getBody()->getContents(), true);
186▕ }
1 [Project Path]\vendor\meilisearch\meilisearch-php\src\Http\Client.php:165
MeiliSearch\Http\Client::parseResponse(Object(GuzzleHttp\Psr7\Response))
2 [Project Path]\vendor\meilisearch\meilisearch-php\src\Http\Client.php:101
MeiliSearch\Http\Client::execute(Object(GuzzleHttp\Psr7\Request))
Seems like this scout driver is making the post request to 127.0.0.1:63076 "POST /indexes/users/documents?primaryKey=id HTTP/1.1" 400 232 "-" "GuzzleHttp/7" 0.000152 and because the post contains the query param primaryKey=id the import fails.
This seems to be an issue with the meilisearch documentation as it clearly states on this page
If you want to set the primary key of your index through this route, it only has to be done the first time you add documents to the index. After which it will be ignored if given.
However when I test the post with Insomnia/Postman the same error happens if I add ?primaryKey=id so the documentation is wrong or meilisearch doesn't handle properly the primaryKey properly (shouldn't raise an error if the primaryKey is the same with the one already defined on the index).
I'll probably open an issue on the meilisearch documentation repo too but this issue needs to be fixed in this scout driver too.
I've been trying to set up this scout driver in my project for the last 2 days and seems like there are a couple of more issues and I started to question myself, is meilisearch production ready? They seem to change a lot of things and leave documentation behind with the updates. Does anyone else use it in production for let's say 1M small documents?
The text was updated successfully, but these errors were encountered:
I don't succeed to reproduce the issue you mention on Postman
push documents with ?primaryKey=id -> the index is created at the same time the documents are pushed and the primary key id is set.
push other documents with ?primaryKey=id -> according to what you say, it should raise a A primary key is already present. It's impossible to update it error. But it did not for me.
What is the version of MeiliSearch you are using?
We had this issue on a MeiliSearch release candidate (RC) of the v0.19.0 but we fix it and this behavior does not exist in the v0.19.0.
If you use docker can you launch those commands to launch MeiliSearch:
docker pull getmeili/meilisearch:latest # Fetch the latest version of MeiliSearch image from Docker Hub
docker run -it --rm -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --master-key=masterKey
if you don't use docker, can you download it this way:
curl -L https://install.meilisearch.com | sh
./meilisearch
If it does not fix anything and you are already using the v0.19.0 of MeiliSearch can you exactly detail the steps you've done with Postan/Insomnia on the MeiliSearch repository? Because this would be a MeiliSearch issue and not an issue related to the laraval-scout plugin.
You are right, it works with docker so I think the problem is on my setup.
I am using windows10 so I had to build it from source (v0.19.0 not RC). This might be the issue but I can't think of any reason, I'll just use docker for now.
New instalation of the latest version of Laravel 8, with one some users in the database.
When running this command:
php artisan scout:import "App\Models\User"
The response is:
Seems like this scout driver is making the post request to
127.0.0.1:63076 "POST /indexes/users/documents?primaryKey=id HTTP/1.1" 400 232 "-" "GuzzleHttp/7" 0.000152
and because the post contains the query paramprimaryKey=id
the import fails.This seems to be an issue with the meilisearch documentation as it clearly states on this page
However when I test the post with Insomnia/Postman the same error happens if I add
?primaryKey=id
so the documentation is wrong or meilisearch doesn't handle properly the primaryKey properly (shouldn't raise an error if the primaryKey is the same with the one already defined on the index).I'll probably open an issue on the meilisearch documentation repo too but this issue needs to be fixed in this scout driver too.
I've been trying to set up this scout driver in my project for the last 2 days and seems like there are a couple of more issues and I started to question myself, is meilisearch production ready? They seem to change a lot of things and leave documentation behind with the updates. Does anyone else use it in production for let's say 1M small documents?
The text was updated successfully, but these errors were encountered: