Skip to content

Commit

Permalink
Generate indices.validate_query
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed Dec 18, 2024
1 parent 4423966 commit ffb842f
Show file tree
Hide file tree
Showing 8 changed files with 491 additions and 265 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1109,4 +1109,31 @@ public final CompletableFuture<UpgradeResponse> upgrade(Function<UpgradeRequest.
public final CompletableFuture<UpgradeResponse> upgrade() throws IOException, OpenSearchException {
return upgrade(new UpgradeRequest.Builder().build());
}

// ----- Endpoint: indices.validate_query

/**
* Allows a user to validate a potentially expensive query without executing it.
*/
public CompletableFuture<ValidateQueryResponse> validateQuery(ValidateQueryRequest request) throws IOException, OpenSearchException {
return this.transport.performRequestAsync(request, ValidateQueryRequest._ENDPOINT, this.transportOptions);
}

/**
* Allows a user to validate a potentially expensive query without executing it.
*
* @param fn a function that initializes a builder to create the {@link ValidateQueryRequest}
*/
public final CompletableFuture<ValidateQueryResponse> validateQuery(
Function<ValidateQueryRequest.Builder, ObjectBuilder<ValidateQueryRequest>> fn
) throws IOException, OpenSearchException {
return validateQuery(fn.apply(new ValidateQueryRequest.Builder()).build());
}

/**
* Allows a user to validate a potentially expensive query without executing it.
*/
public final CompletableFuture<ValidateQueryResponse> validateQuery() throws IOException, OpenSearchException {
return validateQuery(new ValidateQueryRequest.Builder().build());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1088,4 +1088,30 @@ public final UpgradeResponse upgrade(Function<UpgradeRequest.Builder, ObjectBuil
public final UpgradeResponse upgrade() throws IOException, OpenSearchException {
return upgrade(new UpgradeRequest.Builder().build());
}

// ----- Endpoint: indices.validate_query

/**
* Allows a user to validate a potentially expensive query without executing it.
*/
public ValidateQueryResponse validateQuery(ValidateQueryRequest request) throws IOException, OpenSearchException {
return this.transport.performRequest(request, ValidateQueryRequest._ENDPOINT, this.transportOptions);
}

/**
* Allows a user to validate a potentially expensive query without executing it.
*
* @param fn a function that initializes a builder to create the {@link ValidateQueryRequest}
*/
public final ValidateQueryResponse validateQuery(Function<ValidateQueryRequest.Builder, ObjectBuilder<ValidateQueryRequest>> fn)
throws IOException, OpenSearchException {
return validateQuery(fn.apply(new ValidateQueryRequest.Builder()).build());
}

/**
* Allows a user to validate a potentially expensive query without executing it.
*/
public final ValidateQueryResponse validateQuery() throws IOException, OpenSearchException {
return validateQuery(new ValidateQueryRequest.Builder().build());
}
}
Loading

0 comments on commit ffb842f

Please sign in to comment.