You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by "romain.gauthier (Jira)" <ji...@apache.org> on 2021/02/15 14:00:03 UTC

[jira] [Created] (UNOMI-430) Make Unomi batchProfilesUpdate use ES scroll query

romain.gauthier created UNOMI-430:
-------------------------------------

             Summary: Make Unomi batchProfilesUpdate use ES scroll query
                 Key: UNOMI-430
                 URL: https://issues.apache.org/jira/browse/UNOMI-430
             Project: Apache Unomi
          Issue Type: Improvement
            Reporter: romain.gauthier
             Fix For: 2.0.0


*As a developer* 
*I want to ensure good performances when calling batchProfilesUpdate described here* https://unomi.incubator.apache.org/rest-api-doc/#-244007327*

h3. Acceptance criteria

When I call batchProfilesUpdate
Then Elasticsearch scrollquery should be used to ensure good performances

When I call batchProfilesUpdate 
Then I should be able to configure the window size (1000) and the duration of the scroll validity


h3. Designer notes
 
 
h3. Developer notes
This method

{code:java}
 public void batchProfilesUpdate(BatchUpdate update) {
 ParserHelper.resolveConditionType(definitionsService, update.getCondition());
 List<Profile> profiles = persistenceService.query(update.getCondition(), null, Profile.class);
 for (Profile profile : profiles) {
 if (PropertyHelper.setProperty(profile, update.getPropertyName(), update.getPropertyValue(), update.getStrategy())) {
 save(profile);
 }
 }
 }
{code}

should be updated to something like:

{code:java}
 public void batchProfilesUpdate(BatchUpdate update) {
 ParserHelper.resolveConditionType(definitionsService, update.getCondition());
 PartialList<Profile> profiles = persistenceService.query(update.getCondition(), null, Profile.class, 0,1000, "10m");
 while (profiles.getList().size() > 0) {
 for (Profile profile : profiles.getList()) {
 if (PropertyHelper.setProperty(profile, update.getPropertyName(), update.getPropertyValue(), update.getStrategy())) {
 save(profile);
 }
 }
 profiles = persistenceService.continueScrollQuery(Profile.class, profiles.getScrollIdentifier(), profiles.getScrollTimeValidity());
 if (profiles == null || profiles.getList().size() == 0) {
 break;
 }
 }
 }
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)