mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
parent
32a9f427ef
commit
10a2ef3618
19 changed files with 33 additions and 33 deletions
|
@ -53,7 +53,7 @@ describe('Filter Manager', function () {
|
|||
const field = getField(indexPattern, 'script number');
|
||||
expected.meta.field = 'script number';
|
||||
_.set(expected, 'script.script', {
|
||||
inline: '(' + field.script + ') == value',
|
||||
source: '(' + field.script + ') == value',
|
||||
lang: 'expression',
|
||||
params: {
|
||||
value: 5,
|
||||
|
|
|
@ -51,7 +51,7 @@ describe('Filter Manager', function () {
|
|||
expected.meta.field = 'script number';
|
||||
_.set(expected, 'script.script', {
|
||||
lang: 'expression',
|
||||
inline: '(' + field.script + ')>=gte && (' + field.script + ')<=lte',
|
||||
source: '(' + field.script + ')>=gte && (' + field.script + ')<=lte',
|
||||
params: {
|
||||
value: '>=1 <=3',
|
||||
gte: 1,
|
||||
|
@ -68,7 +68,7 @@ describe('Filter Manager', function () {
|
|||
`gte(() -> { ${field.script} }, params.gte) && ` +
|
||||
`lte(() -> { ${field.script} }, params.lte)`;
|
||||
|
||||
const inlineScript = buildRangeFilter(field, { gte: 1, lte: 3 }, indexPattern).script.script.inline;
|
||||
const inlineScript = buildRangeFilter(field, { gte: 1, lte: 3 }, indexPattern).script.script.source;
|
||||
expect(inlineScript).to.be(expected);
|
||||
});
|
||||
|
||||
|
@ -89,7 +89,7 @@ describe('Filter Manager', function () {
|
|||
params[key] = 5;
|
||||
const filter = buildRangeFilter(field, params, indexPattern);
|
||||
|
||||
expect(filter.script.script.inline).to.be(
|
||||
expect(filter.script.script.source).to.be(
|
||||
'(' + field.script + ')' + operator + key);
|
||||
expect(filter.script.script.params[key]).to.be(5);
|
||||
expect(filter.script.script.params.value).to.be(operator + 5);
|
||||
|
@ -120,7 +120,7 @@ describe('Filter Manager', function () {
|
|||
it('does not contain a script condition for the infinite side', function () {
|
||||
const field = getField(indexPattern, 'script number');
|
||||
const script = field.script;
|
||||
expect(filter.script.script.inline).to.equal(`(${script})>=gte`);
|
||||
expect(filter.script.script.source).to.equal(`(${script})>=gte`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -40,7 +40,7 @@ export function getPhraseScript(field, value) {
|
|||
|
||||
return {
|
||||
script: {
|
||||
inline: script,
|
||||
source: script,
|
||||
lang: field.lang,
|
||||
params: {
|
||||
value: convertedValue
|
||||
|
|
|
@ -96,7 +96,7 @@ export function getRangeScript(field, params) {
|
|||
|
||||
return {
|
||||
script: {
|
||||
inline: script,
|
||||
source: script,
|
||||
params: knownParams,
|
||||
lang: field.lang
|
||||
}
|
||||
|
|
|
@ -62,9 +62,9 @@ export default function (api) {
|
|||
|
||||
api.addGlobalAutocompleteRules('script', {
|
||||
__template: {
|
||||
inline: 'SCRIPT'
|
||||
source: 'SCRIPT'
|
||||
},
|
||||
inline: 'SCRIPT',
|
||||
source: 'SCRIPT',
|
||||
file: 'FILE_SCRIPT_NAME',
|
||||
id: 'SCRIPT_ID',
|
||||
lang: '',
|
||||
|
|
|
@ -207,7 +207,7 @@ export default function (api) {
|
|||
api.addEndpointDescription('render_search_template', {
|
||||
data_autocomplete_rules: {
|
||||
__one_of: [
|
||||
{ inline: { __scope_link: 'search' } },
|
||||
{ source: { __scope_link: 'search' } },
|
||||
{ __scope_link: 'GLOBAL.script' },
|
||||
],
|
||||
params: {},
|
||||
|
|
|
@ -322,7 +322,7 @@ describe('Input Tokenization', () => {
|
|||
['start', 'json', 'json', 'start'],
|
||||
'POST _search\n' +
|
||||
'{\n' +
|
||||
' "script": { "inline": "" }\n' +
|
||||
' "script": { "source": "" }\n' +
|
||||
'}'
|
||||
);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Scripts in requests
|
||||
-------------------------------------
|
||||
{
|
||||
"f": { "script" : { "inline": "test\ntest\\2" } },
|
||||
"f": { "script" : { "source": "test\ntest\\2" } },
|
||||
"g": { "script" : "second + \"\\\";" },
|
||||
"f": "short with \\",
|
||||
"h": 1,
|
||||
|
@ -10,7 +10,7 @@ Scripts in requests
|
|||
}
|
||||
-------------------------------------
|
||||
{
|
||||
"f": { "script" : { "inline": """
|
||||
"f": { "script" : { "source": """
|
||||
test
|
||||
test\2
|
||||
""" } },
|
||||
|
|
|
@ -45,7 +45,7 @@ const termsAgg = ({ field, size, direction, query }) => {
|
|||
|
||||
if (field.scripted) {
|
||||
terms.script = {
|
||||
inline: field.script,
|
||||
source: field.script,
|
||||
lang: field.lang
|
||||
};
|
||||
terms.valueType = field.type === 'number' ? 'float' : field.type;
|
||||
|
|
|
@ -31,7 +31,7 @@ const minMaxAgg = (field) => {
|
|||
const aggBody = {};
|
||||
if (field.scripted) {
|
||||
aggBody.script = {
|
||||
inline: field.script,
|
||||
source: field.script,
|
||||
lang: field.lang
|
||||
};
|
||||
} else {
|
||||
|
|
|
@ -143,7 +143,7 @@ describe(filename, () => {
|
|||
expect(agg.time_buckets.aggs['avg(scriptedBytes)']).to.eql({
|
||||
avg: {
|
||||
script: {
|
||||
inline: 'doc["bytes"].value',
|
||||
source: 'doc["bytes"].value',
|
||||
lang: 'painless'
|
||||
}
|
||||
}
|
||||
|
@ -338,14 +338,14 @@ describe(filename, () => {
|
|||
|
||||
expect(aggs.scriptedBeer.meta.type).to.eql('split');
|
||||
expect(aggs.scriptedBeer.terms.script).to.eql({
|
||||
inline: 'doc["beer"].value',
|
||||
source: 'doc["beer"].value',
|
||||
lang: 'painless'
|
||||
});
|
||||
expect(aggs.scriptedBeer.terms.size).to.eql(5);
|
||||
|
||||
expect(aggs.scriptedBeer.aggs.scriptedWine.meta.type).to.eql('split');
|
||||
expect(aggs.scriptedBeer.aggs.scriptedWine.terms.script).to.eql({
|
||||
inline: 'doc["wine"].value',
|
||||
source: 'doc["wine"].value',
|
||||
lang: 'painless'
|
||||
});
|
||||
expect(aggs.scriptedBeer.aggs.scriptedWine.terms.size).to.eql(10);
|
||||
|
|
|
@ -27,7 +27,7 @@ export function buildAggBody(fieldName, scriptedFields) {
|
|||
if (scriptedField) {
|
||||
return {
|
||||
script: {
|
||||
inline: scriptedField.script,
|
||||
source: scriptedField.script,
|
||||
lang: scriptedField.lang
|
||||
}
|
||||
};
|
||||
|
|
|
@ -46,7 +46,7 @@ export default function createDateAgg(config, tlConfig, scriptedFields) {
|
|||
dateAgg.time_buckets.aggs[metric] = {
|
||||
bucket_script: {
|
||||
buckets_path: '_count',
|
||||
script: { inline: '_value', lang: 'expression' }
|
||||
script: { source: '_value', lang: 'expression' }
|
||||
}
|
||||
};
|
||||
} else if (metric[0] && metric[1]) {
|
||||
|
|
|
@ -75,7 +75,7 @@ export const topHitMetricAgg = new MetricAggType({
|
|||
output.params.script_fields = {
|
||||
[ field.name ]: {
|
||||
script: {
|
||||
inline: field.script,
|
||||
source: field.script,
|
||||
lang: field.lang
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ export const topHitMetricAgg = new MetricAggType({
|
|||
{
|
||||
_script: {
|
||||
script: {
|
||||
inline: sortField.script,
|
||||
source: sortField.script,
|
||||
lang: sortField.lang
|
||||
},
|
||||
type: sortField.type,
|
||||
|
|
|
@ -132,7 +132,7 @@ FieldParamType.prototype.write = function (aggConfig, output) {
|
|||
|
||||
if (field.scripted) {
|
||||
output.params.script = {
|
||||
inline: field.script,
|
||||
source: field.script,
|
||||
lang: field.lang,
|
||||
};
|
||||
} else {
|
||||
|
|
|
@ -78,7 +78,7 @@ describe('SearchSource#normalizeSortRequest', function () {
|
|||
normalizedSort = {
|
||||
_script: {
|
||||
script: {
|
||||
inline: indexField.script,
|
||||
source: indexField.script,
|
||||
lang: indexField.lang
|
||||
},
|
||||
type: indexField.type,
|
||||
|
|
|
@ -52,7 +52,7 @@ export function NormalizeSortRequestProvider(config) {
|
|||
sortField = '_script';
|
||||
sortValue = {
|
||||
script: {
|
||||
inline: indexField.script,
|
||||
source: indexField.script,
|
||||
lang: indexField.lang
|
||||
},
|
||||
type: castSortType(indexField.type),
|
||||
|
|
|
@ -38,7 +38,7 @@ export function getComputedFields() {
|
|||
_.each(self.getScriptedFields(), function (field) {
|
||||
scriptFields[field.name] = {
|
||||
script: {
|
||||
inline: field.script,
|
||||
source: field.script,
|
||||
lang: field.lang
|
||||
}
|
||||
};
|
||||
|
|
|
@ -82,7 +82,7 @@ export const watch = {
|
|||
start: {
|
||||
script: {
|
||||
lang: 'painless',
|
||||
inline: `LocalDateTime.ofEpochSecond((doc["timestamp"].date.getMillis()-((doc["bucket_span"].value * 1000)
|
||||
source: `LocalDateTime.ofEpochSecond((doc["timestamp"].date.getMillis()-((doc["bucket_span"].value * 1000)
|
||||
* params.padding)) / 1000, 0, ZoneOffset.UTC).toString()+\":00.000Z\"`,
|
||||
params: {
|
||||
'padding': 10
|
||||
|
@ -92,7 +92,7 @@ export const watch = {
|
|||
end: {
|
||||
script: {
|
||||
lang: 'painless',
|
||||
inline: `LocalDateTime.ofEpochSecond((doc["timestamp"].date.getMillis()+((doc["bucket_span"].value * 1000)
|
||||
source: `LocalDateTime.ofEpochSecond((doc["timestamp"].date.getMillis()+((doc["bucket_span"].value * 1000)
|
||||
* params.padding)) / 1000, 0, ZoneOffset.UTC).toString()+\":00.000Z\"`,
|
||||
params: {
|
||||
'padding': 10
|
||||
|
@ -102,19 +102,19 @@ export const watch = {
|
|||
timestamp_epoch: {
|
||||
script: {
|
||||
lang: 'painless',
|
||||
inline: 'doc["timestamp"].date.getMillis()/1000'
|
||||
source: 'doc["timestamp"].date.getMillis()/1000'
|
||||
}
|
||||
},
|
||||
timestamp_iso8601: {
|
||||
script: {
|
||||
lang: 'painless',
|
||||
inline: 'doc["timestamp"].date'
|
||||
source: 'doc["timestamp"].date'
|
||||
}
|
||||
},
|
||||
score: {
|
||||
script: {
|
||||
lang: 'painless',
|
||||
inline: 'Math.round(doc["anomaly_score"].value)'
|
||||
source: 'Math.round(doc["anomaly_score"].value)'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ export const watch = {
|
|||
score: {
|
||||
script: {
|
||||
lang: 'painless',
|
||||
inline: 'Math.round(doc["influencer_score"].value)'
|
||||
source: 'Math.round(doc["influencer_score"].value)'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ export const watch = {
|
|||
score: {
|
||||
script: {
|
||||
lang: 'painless',
|
||||
inline: 'Math.round(doc["record_score"].value)'
|
||||
source: 'Math.round(doc["record_score"].value)'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue