-
Type: Bug
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Component/s: Automation, Elasticsearch
-
Epic Link:
-
Team:PLATFORM
-
Sprint:nxplatform #14
-
Story Points:1
Context
When running in multi-repositories it makes sense to be able to start the bulk-reindex of one repository.
By passing the right repository argument, we could expect the code to behave as needed:
curl -H 'Content-Type:application/json+nxrequest' -H 'X-NXRepository:us-west' -X POST -d '{"params":{},"context":{}}' -u nco-admin:fsdfwfqDFER34d http://127.0.0.1:8080/nuxeo/api/v1/automation/Elasticsearch.BulkIndex
Issue with the current code
The current code is "half right":
When we delete the index we take into account the repository:
esa.dropAndInitRepositoryIndex(session.getRepositoryName(), false);
However, when we create the BulkCommand we do not set the repository
return bulkService.submit( new BulkCommand.Builder(ACTION_NAME, nxql, username).param(INDEX_UPDATE_ALIAS_PARAM, syncAlias) .build());
As a result, the indexing command will fail or not do what is needed: in my case, I wanted to reindex repository us-east and what it actually did is:
- delete the index for us-east
- try to reindex the default repository that is empty in my case
Invalid query results in an empty document set: org.nuxeo.ecm.core.bulk.message.BulkCommand@100264c3[id=a167973b-3983-4e59-b558-1b9df497895d,action=index,query=SELECT ecm:uuid FROM Document,username=nco-admin,repository=default,bucketSize=1000,batchSize=50,scroller=<null>,genericScroller=false,params={updateAlias=true}]