Closed foralobo closed 3 years ago
Hi @foralobo ,
Kuzzle simply query ES to get the user documents so if you modify them with an ES query Kuzzle will then use the modified documents.
Can you show your ES query so I can try to reproduce?
Of course,
POST /%%kuzzle.users/_update_by_query
{
"script": {
"source": "ctx._source.forasChat = params.forasChat",
"params": {
"forasChat": {
"settings": {
"blocked": {
"list": []
},
"online": {
"all": true,
"exceptions": []
}
}
}
}
}
}
I use kibana to execute this script... and this is result of my query!!
Then I fo to console:
end expand my user "pippo":
It's correct!!
but when I go to manual update of my user "pippo":
IMPORTANT: this is because I, before execute query, had edited manually content of "pippo" from console.
I tried to reproduce but I have the expected behavior:
curl -X POST -H "Content-Type: application/json" "localhost:9200/%%kuzzle.users/_update_by_query" --data '{
"script": {
"source": "ctx._source.forasChat = params.forasChat",
"params": {
"forasChat": {
"settings": {
"blocked": {
"list": []
},
"online": {
"all": true,
"exceptions": []
}
}
}
}
}
Did you try to reload the admin console?
Are you try to edit From console the content of user and then.. re-execute the query?
Did you try to reload the admin console?
Yes I try to reload console and also the server. But no changes happen!! :(
Ok I found the problem.
Kuzzle cache users content in Redis to avoid a request to the database when it comes to load the profileIds
field who contain the information needed by the permission system.
You need to reset the internal cache after your query to Elasticsearch, you can use the admin:resetCache action.
Example with Kourou:
kourou admin:resetCache -a database=internalCache
Great!!!! It Works.... thank you very much
Expected Behavior
When I execute a massive update to users from ES Api (_update_by_query), data must be updated
Current Behavior
The data seems up to date but in reality it is not
Possible Solution
Steps to Reproduce
Context (Environment)
Kuzzle version: (I am in testing with get started docker app) 2.10.4 Node.js version: (I am in testing with get started docker app) v12.18.1 SDK version: JS SDK v. (but is not a problem of SDK)