Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-139947

Error obtaining all the users of a segment if it contains more than 10000 users

    Details

      Description

      Error obtaining all the users of a segment using the segmentsEntryProvider.getSegmentsEntryClassPKs(segmentId, start, end) API if it contains more than 10000 users

      Elasticsearch will return following error:

      2021-09-15 06:43:21.407 ERROR [http-nio-8080-exec-7][ElasticsearchIndexSearcher:169] java.lang.RuntimeException: org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to execute phase [query], all shards failed; shardFailures {[uKJ5EGxBRImfHfHXiUDEag][liferay-36752][0]: RemoteTransportException[[elasticsearchcluster-data-0][192.168.136.3:9300][indices:data/read/search[phase/query]]]; nested: IllegalArgumentException[Result window is too large, from + size must be less than or equal to: [10000] but was [11000]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting.]; }

      Steps to reproduce

      1. Create 20000 users, you can create it using the attached create_20000_users.groovy groovy script
      2. Create a segment that contains all the created users, for example, create a segment with all the users with an email that contains "@liferay.com"
      3. Execute SQL: select * from segmentsEntry to get the segmentsEntryId of the created segment
      4. Execute following groovy script to simulate the call to the segmentsEntryProvider.getSegmentsEntryClassPKs(segmentId, start, end) API, replacing the segmentId with the identifier of the created segment
      5. long segmentid = <<SEGMENT ID>>;
        import com.liferay.osgi.util.ServiceTrackerFactory;
        import com.liferay.segments.provider.SegmentsEntryProviderRegistry;
        SegmentsEntryProviderRegistry segmentsEntryProviderRegistry = ServiceTrackerFactory.open(SegmentsEntryProviderRegistry.class).getService();
        long[] segmentsEntryClassPKs = segmentsEntryProviderRegistry.getSegmentsEntryClassPKs(segmentid, -1 , -1);
        out.println("length: " + segmentsEntryClassPKs.length);
        
      6. Check the script output
        • Expected behavior: The script returns all the 20000 users
        • Wrong behavior: The script returns only 10000 users

        Attachments

          Activity

            People

            Assignee:
            yurena.cabrera Yurena Cabrera
            Reporter:
            jorge.diaz Jorge Diaz
            Participants of an Issue:
            Recent user:
            Clarissa Velazquez
            Engineering Assignee:
            Jorge Diaz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved:
              Days since last comment:
              25 weeks, 6 days ago

                Packages

                Version Package
                7.2.10 DXP FP17
                7.2.10.6 DXP SP6
                7.2.X
                7.3.10.3 DXP SP3
                7.3.X
                7.4.3.5 CE GA5
                7.4.13 DXP U1
                Master