mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 19:13:14 -04:00
[ES|QL] remove chrono literals (#186536)
## Summary The "chrono-literals" can be replaced with the simpler system of `literalOptions`. This is better because it moves us toward having _one_ way to do things and removing Kibana-specific types which don't actually exist in ES|QL and, therefore, can be confusing.
This commit is contained in:
parent
46b21546aa
commit
a0b018b12c
8 changed files with 94 additions and 35 deletions
|
@ -15,7 +15,7 @@ import { statsAggregationFunctionDefinitions } from '../src/definitions/aggs';
|
|||
import { evalFunctionDefinitions } from '../src/definitions/functions';
|
||||
import { groupingFunctionDefinitions } from '../src/definitions/grouping';
|
||||
import { getFunctionSignatures } from '../src/definitions/helpers';
|
||||
import { timeUnits, chronoLiterals } from '../src/definitions/literals';
|
||||
import { timeUnits } from '../src/definitions/literals';
|
||||
import { nonNullable } from '../src/shared/helpers';
|
||||
import {
|
||||
SupportedFieldType,
|
||||
|
@ -1045,14 +1045,10 @@ function getFieldName(
|
|||
}
|
||||
|
||||
const literals = {
|
||||
chrono_literal: chronoLiterals[0].name,
|
||||
time_literal: timeUnits[0],
|
||||
};
|
||||
|
||||
function getLiteralType(typeString: 'chrono_literal' | 'time_literal') {
|
||||
if (typeString === 'chrono_literal') {
|
||||
return literals[typeString];
|
||||
}
|
||||
function getLiteralType(typeString: 'time_literal') {
|
||||
return `1 ${literals[typeString]}`;
|
||||
}
|
||||
|
||||
|
@ -1116,7 +1112,7 @@ function getFieldMapping(
|
|||
}
|
||||
if (/literal$/.test(typeString) && useLiterals) {
|
||||
return {
|
||||
name: getLiteralType(typeString as 'chrono_literal' | 'time_literal'),
|
||||
name: getLiteralType(typeString as 'time_literal'),
|
||||
type,
|
||||
...rest,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue