code: private Collection<String> getFileDirectory(String path)
              throws Exception {
  
          // If the crawler is being closed, we return
          if (closed) {
              return Collections.emptyList();
          }
  
          logger.trace("Querying elasticsearch for files in dir [{}:{}]", PATH_ROOT, SignTool.sign(path));
          Collection<String> files = new ArrayList<>();
          ESSearchResponse response = esClient.search(
                  new ESSearchRequest()
                          .withIndex(fsSettings.getElasticsearch().getIndex())
                          .withSize(REQUEST_SIZE)
                          .addField(FILE_FILENAME)
                          .withESQuery(new ESTermQuery(PATH_ROOT, SignTool.sign(path))));
  
          logger.trace("Response [{}]", response.toString());
          if (response.getHits() != null) {
              for (ESSearchHit hit : response.getHits()) {
                  String name;
                  if (hit.getFields() != null
                          && hit.getFields().get(FILE_FILENAME) != null) {
                      // In case someone disabled _source which is not recommended
                      name = hit.getFields().get(FILE_FILENAME).getValue();
                  } else {
                      // Houston, we have a problem ! We can't get the old files from ES
                      logger.warn("Can't find stored field name to check existing filenames in path [{}]. " +
                              "Please set store: true on field [{}]", path, FILE_FILENAME);
                      throw new RuntimeException("Mapping is incorrect: please set stored: true on field [" +
                              FILE_FILENAME + "].");
                  }
                  files.add(name);
              }
          }
  
          logger.trace("We found: {}", files);
  
          return files;
      }
docs: Searching fo 10000 files (which is somehow limited).