org.elasticsearch.action.ValidateActions Java Examples

The following examples show how to use org.elasticsearch.action.ValidateActions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GetSettingsRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public ActionRequestValidationException validate() {
    ActionRequestValidationException validationException = null;
    if (names == null) {
        validationException = ValidateActions.addValidationError("names may not be null", validationException);
    }
    return validationException;
}
 
Example #2
Source File: FieldStatsRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public ActionRequestValidationException validate() {
    ActionRequestValidationException validationException = super.validate();
    if ("cluster".equals(level) == false && "indices".equals(level) == false) {
        validationException = ValidateActions.addValidationError("invalid level option [" + level + "]", validationException);
    }
    if (fields == null || fields.length == 0) {
        validationException = ValidateActions.addValidationError("no fields specified", validationException);
    }
    return validationException;
}
 
Example #3
Source File: ExplainRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public ActionRequestValidationException validate() {
    ActionRequestValidationException validationException = super.validateNonNullIndex();
    if (type == null) {
        validationException = ValidateActions.addValidationError("type is missing", validationException);
    }
    if (id == null) {
        validationException = ValidateActions.addValidationError("id is missing", validationException);
    }
    if (source == null) {
        validationException = ValidateActions.addValidationError("source is missing", validationException);
    }
    return validationException;
}
 
Example #4
Source File: GetRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public ActionRequestValidationException validate() {
    ActionRequestValidationException validationException = super.validateNonNullIndex();
    if (type == null) {
        validationException = ValidateActions.addValidationError("type is missing", validationException);
    }
    if (id == null) {
        validationException = ValidateActions.addValidationError("id is missing", validationException);
    }
    if (!versionType.validateVersionForReads(version)) {
        validationException = ValidateActions.addValidationError("illegal version value [" + version + "] for version type [" + versionType.name() + "]",
                validationException);
    }
    return validationException;
}
 
Example #5
Source File: GetIndexedScriptRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public ActionRequestValidationException validate() {
    ActionRequestValidationException validationException = null;
    if (scriptLang == null) {
        validationException = ValidateActions.addValidationError("type is missing", validationException);
    }
    if (id == null) {
        validationException = ValidateActions.addValidationError("id is missing", validationException);
    }
    if (!versionType.validateVersionForReads(version)) {
        validationException = ValidateActions.addValidationError("illegal version value [" + version + "] for version type [" + versionType.name() + "]",
                validationException);
    }
    return validationException;
}
 
Example #6
Source File: InstanceShardOperationRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public ActionRequestValidationException validate() {
    ActionRequestValidationException validationException = null;
    if (index == null) {
        validationException = ValidateActions.addValidationError("index is missing", validationException);
    }
    return validationException;
}
 
Example #7
Source File: SingleShardRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
/**
 * @return a validation exception if the index property hasn't been set
 */
protected ActionRequestValidationException validateNonNullIndex() {
    ActionRequestValidationException validationException = null;
    if (index == null) {
        validationException = ValidateActions.addValidationError("index is missing", validationException);
    }
    return validationException;
}
 
Example #8
Source File: TermVectorsRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public ActionRequestValidationException validate() {
    ActionRequestValidationException validationException = super.validateNonNullIndex();
    if (type == null) {
        validationException = ValidateActions.addValidationError("type is missing", validationException);
    }
    if (id == null && doc == null) {
        validationException = ValidateActions.addValidationError("id or doc is missing", validationException);
    }
    return validationException;
}
 
Example #9
Source File: TermsByQueryRequest.java    From siren-join with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Validates the request
 *
 * @return null if valid, exception otherwise
 */
@Override
public ActionRequestValidationException validate() {
  ActionRequestValidationException validationException = super.validate();
  if (termsEncoding != null && termsEncoding.equals(TermsEncoding.BYTES)) {
    if (maxTermsPerShard == null) {
      validationException = ValidateActions.addValidationError("maxTermsPerShard not specified for terms encoding [bytes]", validationException);
    }
  }
  return validationException;
}