コード例 #1
0
    @Override
    public ActionRequest request(IndexRecord record, long timestamp, String user) {
      log.debug(
          "deleting record " + record.id() + " for " + record.type() + " at " + record.index());

      return new DeleteRequest(record.index(), record.type(), record.id());
    }
コード例 #2
0
    @Override
    public ActionRequest request(IndexRecord record, long timestamp, String user) {
      log.debug(
          "updating record " + record.id() + " for " + record.type() + " at " + record.index());

      return new IndexRequest(record.index(), record.type(), record.id())
          .source(sourceOf(record, timestamp, user))
          .parent(record.parent())
          .versionType(VersionType.EXTERNAL_GTE)
          .version(timestamp);
    }
コード例 #3
0
    @Override
    public ActionRequest request(IndexRecord record, long timestamp, String user) {
      final String id = emptyToNull(record.id()); // auto-generate if empty
      log.debug(
          "overwriting record "
              + nonNull(id, "_auto_")
              + " for "
              + record.type()
              + " at "
              + record.index());

      return new IndexRequest(record.index(), record.type(), id)
          .source(sourceOf(record, timestamp, user))
          .parent(record.parent())
          .versionType(VersionType.FORCE)
          .version(timestamp);
    }