Skip to content

Commit

Permalink
Add epoch_millis format type to query builder
Browse files Browse the repository at this point in the history
  • Loading branch information
ersin-erdal committed Feb 16, 2023
1 parent 2c1e9fd commit 89082fb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ describe('buildSortedEventsQuery', () => {
sort: [
{
timefield: {
format: 'strict_date_optional_time||epoch_millis',
order: 'asc',
},
},
Expand Down Expand Up @@ -111,6 +112,7 @@ describe('buildSortedEventsQuery', () => {
sort: [
{
timefield: {
format: 'strict_date_optional_time||epoch_millis',
order: 'asc',
},
},
Expand Down Expand Up @@ -160,6 +162,7 @@ describe('buildSortedEventsQuery', () => {
sort: [
{
timefield: {
format: 'strict_date_optional_time||epoch_millis',
order: 'asc',
},
},
Expand Down Expand Up @@ -210,6 +213,7 @@ describe('buildSortedEventsQuery', () => {
sort: [
{
timefield: {
format: 'strict_date_optional_time||epoch_millis',
order: 'asc',
},
},
Expand Down Expand Up @@ -272,6 +276,7 @@ describe('buildSortedEventsQuery', () => {
sort: [
{
timefield: {
format: 'strict_date_optional_time||epoch_millis',
order: 'asc',
},
},
Expand Down Expand Up @@ -320,6 +325,7 @@ describe('buildSortedEventsQuery', () => {
sort: [
{
timefield: {
format: 'strict_date_optional_time||epoch_millis',
order: 'desc',
},
},
Expand Down Expand Up @@ -368,6 +374,7 @@ describe('buildSortedEventsQuery', () => {
sort: [
{
timefield: {
format: 'strict_date_optional_time||epoch_millis',
order: 'asc',
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const buildSortedEventsQuery = ({
{
[sortField]: {
order: sortOrder ?? 'asc',
format: 'strict_date_optional_time||epoch_millis',
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,14 @@ export function updateSearchSource(

const searchSourceChild = searchSource.createChild();
searchSourceChild.setField('filter', filters as Filter[]);
searchSourceChild.setField('sort', [{ [timeFieldName]: SortDirection.desc }]);
searchSourceChild.setField('sort', [
{
[timeFieldName]: {
order: SortDirection.desc,
format: 'strict_date_optional_time||epoch_millis',
},
},
]);
searchSourceChild.setField(
'aggs',
buildAggregation({
Expand Down

0 comments on commit 89082fb

Please sign in to comment.