org.elasticsearch.script.Script.getType()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中org.elasticsearch.script.Script.getType()方法的一些代码示例,展示了Script.getType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Script.getType()方法的具体详情如下:
包路径:org.elasticsearch.script.Script
类名称:Script
方法名:getType

Script.getType介绍

[英]Method for getting the type.
[中]获取类型的方法。

代码示例

代码示例来源:origin: org.elasticsearch/elasticsearch

/**
 * @deprecated Use {@link #script()} instead
 */
@Deprecated
public ScriptType scriptType() {
  return this.script == null ? null : this.script.getType();
}

代码示例来源:origin: org.elasticsearch/elasticsearch

private static Script deepCopyScript(Script script, SearchContext context) {
  if (script != null) {
    Map<String, Object> params = script.getParams();
    if (params != null) {
      params = deepCopyParams(params, context);
    }
    return new Script(script.getType(), script.getLang(), script.getIdOrCode(), params);
  } else {
    return null;
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

Objects.requireNonNull(context);
ScriptType type = script.getType();
String lang = script.getLang();
String idOrCode = script.getIdOrCode();
boolean notSupported = context.name.equals(UpdateScript.CONTEXT.name);
if (expression && notSupported) {
  throw new UnsupportedOperationException("scripts of type [" + script.getType() + "]," +
    " operation [" + context.name + "] and lang [" + lang + "] are not supported");

代码示例来源:origin: org.elasticsearch/elasticsearch

private void updateOrCreateScript(String scriptContent, ScriptType type, String lang, Map<String, Object> params) {
  Script script = script();
  if (script == null) {
    script = new Script(type == null ? ScriptType.INLINE : type, lang, scriptContent == null ? "" : scriptContent, params);
  } else {
    String newScriptContent = scriptContent == null ? script.getIdOrCode() : scriptContent;
    ScriptType newScriptType = type == null ? script.getType() : type;
    String newScriptLang = lang == null ? script.getLang() : lang;
    Map<String, Object> newScriptParams = params == null ? script.getParams() : params;
    script = new Script(newScriptType, newScriptLang, newScriptContent, newScriptParams);
  }
  script(script);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/**
 * @deprecated Use {@link #script()} instead
 */
@Deprecated
public ScriptType scriptType() {
  return this.script == null ? null : this.script.getType();
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

/**
 * @deprecated Use {@link #script()} instead
 */
@Deprecated
public ScriptType scriptType() {
  return this.script == null ? null : this.script.getType();
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * @deprecated Use {@link #script()} instead
 */
@Deprecated
public ScriptType scriptType() {
  return this.script == null ? null : this.script.getType();
}

代码示例来源:origin: harbby/presto-connectors

/**
 * @deprecated Use {@link #script()} instead
 */
@Deprecated
public ScriptService.ScriptType scriptType() {
  return this.script == null ? null : this.script.getType();
}

代码示例来源:origin: org.codelibs.elasticsearch.module/analysis-common

public PredicateTokenFilterScriptFactory(IndexSettings indexSettings, String name, Settings settings, ScriptService scriptService) {
  super(indexSettings, name, settings);
  Settings scriptSettings = settings.getAsSettings("script");
  Script script = Script.parse(scriptSettings);
  if (script.getType() != ScriptType.INLINE) {
    throw new IllegalArgumentException("Cannot use stored scripts in tokenfilter [" + name + "]");
  }
  this.factory = scriptService.compile(script, AnalysisPredicateScript.CONTEXT);
}

代码示例来源:origin: org.codelibs.elasticsearch.module/analysis-common

ScriptedConditionTokenFilterFactory(IndexSettings indexSettings, String name,
                      Settings settings, ScriptService scriptService) {
  super(indexSettings, name, settings);
  Settings scriptSettings = settings.getAsSettings("script");
  Script script = Script.parse(scriptSettings);
  if (script.getType() != ScriptType.INLINE) {
    throw new IllegalArgumentException("Cannot use stored scripts in tokenfilter [" + name + "]");
  }
  this.factory = scriptService.compile(script, AnalysisPredicateScript.CONTEXT);
  this.filterNames = settings.getAsList("filter");
  if (this.filterNames.isEmpty()) {
    throw new IllegalArgumentException("Empty list of filters provided to tokenfilter [" + name + "]");
  }
}

代码示例来源:origin: harbby/presto-connectors

private static Script insertParams(Script script, Map<String, Object> params) {
  if (script == null) {
    return null;
  }
  return new Script(script.getScript(), script.getType(), script.getLang(), params);
}

代码示例来源:origin: org.codelibs.elasticsearch.module/lang-painless

@Override
public ActionRequestValidationException validate() {
  ActionRequestValidationException validationException = null;
  if (script.getType() != ScriptType.INLINE) {
    validationException = addValidationError("only inline scripts are supported", validationException);
  }
  if (needDocumentAndIndex(context)) {
    if (contextSetup.index == null) {
      validationException = addValidationError("index is a required parameter for current context", validationException);
    }
    if (contextSetup.document == null) {
      validationException = addValidationError("document is a required parameter for current context", validationException);
    }
  }
  return validationException;
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

private static Script deepCopyScript(Script script, SearchContext context) {
  if (script != null) {
    Map<String, Object> params = script.getParams();
    if (params != null) {
      params = deepCopyParams(params, context);
    }
    return new Script(script.getType(), script.getLang(), script.getIdOrCode(), params);
  } else {
    return null;
  }
}

代码示例来源:origin: harbby/presto-connectors

private static Script deepCopyScript(Script script, SearchContext context) {
  if (script != null) {
    Map<String, Object> params = script.getParams();
    if (params != null) {
      params = deepCopyParams(params, context);
    }
    return new Script(script.getScript(), script.getType(), script.getLang(), params);
  } else {
    return null;
  }
}

代码示例来源:origin: apache/servicemix-bundles

private static Script deepCopyScript(Script script, SearchContext context) {
  if (script != null) {
    Map<String, Object> params = script.getParams();
    if (params != null) {
      params = deepCopyParams(params, context);
    }
    return new Script(script.getType(), script.getLang(), script.getIdOrCode(), params);
  } else {
    return null;
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

private static Script deepCopyScript(Script script, SearchContext context) {
  if (script != null) {
    Map<String, Object> params = script.getParams();
    if (params != null) {
      params = deepCopyParams(params, context);
    }
    return new Script(script.getType(), script.getLang(), script.getIdOrCode(), params);
  } else {
    return null;
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

private void updateOrCreateScript(String scriptContent, ScriptType type, String lang, Map<String, Object> params) {
  Script script = script();
  if (script == null) {
    script = new Script(type == null ? ScriptType.INLINE : type, lang, scriptContent == null ? "" : scriptContent, params);
  } else {
    String newScriptContent = scriptContent == null ? script.getIdOrCode() : scriptContent;
    ScriptType newScriptType = type == null ? script.getType() : type;
    String newScriptLang = lang == null ? script.getLang() : lang;
    Map<String, Object> newScriptParams = params == null ? script.getParams() : params;
    script = new Script(newScriptType, newScriptLang, newScriptContent, newScriptParams);
  }
  script(script);
}

代码示例来源:origin: apache/servicemix-bundles

private void updateOrCreateScript(String scriptContent, ScriptType type, String lang, Map<String, Object> params) {
  Script script = script();
  if (script == null) {
    script = new Script(type == null ? ScriptType.INLINE : type, lang, scriptContent == null ? "" : scriptContent, params);
  } else {
    String newScriptContent = scriptContent == null ? script.getIdOrCode() : scriptContent;
    ScriptType newScriptType = type == null ? script.getType() : type;
    String newScriptLang = lang == null ? script.getLang() : lang;
    Map<String, Object> newScriptParams = params == null ? script.getParams() : params;
    script = new Script(newScriptType, newScriptLang, newScriptContent, newScriptParams);
  }
  script(script);
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

private void updateOrCreateScript(String scriptContent, ScriptType type, String lang, Map<String, Object> params) {
  Script script = script();
  if (script == null) {
    script = new Script(type == null ? ScriptType.INLINE : type, lang, scriptContent == null ? "" : scriptContent, params);
  } else {
    String newScriptContent = scriptContent == null ? script.getIdOrCode() : scriptContent;
    ScriptType newScriptType = type == null ? script.getType() : type;
    String newScriptLang = lang == null ? script.getLang() : lang;
    Map<String, Object> newScriptParams = params == null ? script.getParams() : params;
    script = new Script(newScriptType, newScriptLang, newScriptContent, newScriptParams);
  }
  script(script);
}

代码示例来源:origin: harbby/presto-connectors

private void updateOrCreateScript(String scriptContent, ScriptType type, String lang, Map<String, Object> params) {
  Script script = script();
  if (script == null) {
    script = new Script(scriptContent == null ? "" : scriptContent, type == null ? ScriptType.INLINE : type, lang, params);
  } else {
    String newScriptContent = scriptContent == null ? script.getScript() : scriptContent;
    ScriptType newScriptType = type == null ? script.getType() : type;
    String newScriptLang = lang == null ? script.getLang() : lang;
    Map<String, Object> newScriptParams = params == null ? script.getParams() : params;
    script = new Script(newScriptContent, newScriptType, newScriptLang, newScriptParams);
  }
  script(script);
}

相关文章