File tree Expand file tree Collapse file tree 8 files changed +64
-61
lines changed
x-pack/plugins/security_solution Expand file tree Collapse file tree 8 files changed +64
-61
lines changed Original file line number Diff line number Diff line change @@ -53,57 +53,3 @@ export interface EqlSearchResponse<T> {
5353 events ?: Array < BaseHit < T > > ;
5454 } ;
5555}
56-
57- export interface ShardsResponse {
58- total : number ;
59- successful : number ;
60- failed : number ;
61- skipped : number ;
62- failures ?: ShardError [ ] ;
63- }
64-
65- export interface ShardError {
66- shard : number ;
67- index : string ;
68- node : string ;
69- reason : {
70- type : string ;
71- reason : string ;
72- index_uuid : string ;
73- index : string ;
74- caused_by : {
75- type : string ;
76- reason : string ;
77- } ;
78- } ;
79- }
80-
81- export interface SearchResponse < T > {
82- took : number ;
83- timed_out : boolean ;
84- _scroll_id ?: string ;
85- _shards : ShardsResponse ;
86- hits : {
87- total : TotalValue | number ;
88- max_score : number ;
89- hits : Array <
90- BaseHit < T > & {
91- _type : string ;
92- _score : number ;
93- _version ?: number ;
94- _explanation ?: Explanation ;
95- fields ?: string [ ] ;
96- // eslint-disable-next-line @typescript-eslint/no-explicit-any
97- highlight ?: any ;
98- // eslint-disable-next-line @typescript-eslint/no-explicit-any
99- inner_hits ?: any ;
100- matched_queries ?: string [ ] ;
101- sort ?: string [ ] ;
102- }
103- > ;
104- } ;
105- // eslint-disable-next-line @typescript-eslint/no-explicit-any
106- aggregations ?: any ;
107- }
108-
109- export type SearchHit = SearchResponse < object > [ 'hits' ] [ 'hits' ] [ 0 ] ;
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
1717 DETECTION_ENGINE_PREPACKAGED_URL ,
1818 DETECTION_ENGINE_EQL_VALIDATION_URL ,
1919} from '../../../../../common/constants' ;
20+ import { ShardsResponse } from '../../../types' ;
2021import {
2122 RuleAlertType ,
2223 IRuleSavedAttributesSavedObjectAttributes ,
@@ -29,7 +30,7 @@ import { SetSignalsStatusSchemaDecoded } from '../../../../../common/detection_e
2930import { getCreateRulesSchemaMock } from '../../../../../common/detection_engine/schemas/request/create_rules_schema.mock' ;
3031import { getListArrayMock } from '../../../../../common/detection_engine/schemas/types/lists.mock' ;
3132import { getEqlValidationSchemaMock } from '../../../../../common/detection_engine/schemas/request/eql_validation_schema.mock' ;
32- import { EqlSearchResponse , ShardsResponse } from '../../../../../common/detection_engine/types' ;
33+ import { EqlSearchResponse } from '../../../../../common/detection_engine/types' ;
3334
3435export const typicalSetStatusSignalByIdsPayload = ( ) : SetSignalsStatusSchemaDecoded => ( {
3536 signal_ids : [ 'somefakeid1' , 'somefakeid2' ] ,
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ import {
1111} from './__mocks__/es_results' ;
1212import { singleSearchAfter } from './single_search_after' ;
1313import { alertsMock , AlertServicesMock } from '../../../../../alerts/server/mocks' ;
14+ import { ShardError } from '../../types' ;
1415import { buildRuleMessageFactory } from './rule_messages' ;
15- import { ShardError } from '../../../../common/detection_engine/types' ;
1616
1717const buildRuleMessage = buildRuleMessageFactory ( {
1818 id : 'fake id' ,
Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ import {
1414 AlertExecutorOptions ,
1515 AlertServices ,
1616} from '../../../../../alerts/server' ;
17+ import { SearchResponse } from '../../types' ;
1718import {
18- SearchResponse ,
1919 EqlSearchResponse ,
2020 BaseHit ,
2121 RuleAlertAction ,
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ import {
4646 sampleDocSearchResultsNoSortIdNoHits ,
4747 repeatedSearchResultsWithSortId ,
4848} from './__mocks__/es_results' ;
49- import { ShardError } from '../../../../common/detection_engine/ types' ;
49+ import { ShardError } from '../../types' ;
5050
5151const buildRuleMessage = buildRuleMessageFactory ( {
5252 id : 'fake id' ,
Original file line number Diff line number Diff line change @@ -26,7 +26,8 @@ import { BuildRuleMessage } from './rule_messages';
2626import { parseScheduleDates } from '../../../../common/detection_engine/parse_schedule_dates' ;
2727import { hasLargeValueList } from '../../../../common/detection_engine/utils' ;
2828import { MAX_EXCEPTION_LIST_SIZE } from '../../../../../lists/common/constants' ;
29- import { ShardError } from '../../../../common/detection_engine/types' ;
29+ import { ShardError } from '../../types' ;
30+
3031interface SortExceptionsReturn {
3132 exceptionsWithValueLists : ExceptionListItemSchema [ ] ;
3233 exceptionsWithoutValueLists : ExceptionListItemSchema [ ] ;
Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ import {
1717 DocValueFieldsInput ,
1818} from '../../graphql/types' ;
1919import { FrameworkRequest , RequestOptionsPaginated } from '../framework' ;
20- import { Hit , Hits } from '../types' ;
21- import { SearchHit , TotalValue } from '../../../common/detection_engine/types' ;
20+ import { Hit , Hits , SearchHit } from '../types' ;
21+ import { TotalValue } from '../../../common/detection_engine/types' ;
2222
2323export interface HostsAdapter {
2424 getHosts ( req : FrameworkRequest , options : HostsRequestOptions ) : Promise < HostsData > ;
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import { Sources } from './sources';
1616import { Note } from './note/saved_object' ;
1717import { PinnedEvent } from './pinned_event/saved_object' ;
1818import { Timeline } from './timeline/saved_object' ;
19+ import { TotalValue , BaseHit , Explanation } from '../../common/detection_engine/types' ;
1920
2021export * from './hosts' ;
2122
@@ -39,6 +40,60 @@ export interface SiemContext {
3940 user : AuthenticatedUser | null ;
4041}
4142
43+ export interface ShardsResponse {
44+ total : number ;
45+ successful : number ;
46+ failed : number ;
47+ skipped : number ;
48+ failures ?: ShardError [ ] ;
49+ }
50+
51+ export interface ShardError {
52+ shard : number ;
53+ index : string ;
54+ node : string ;
55+ reason : {
56+ type : string ;
57+ reason : string ;
58+ index_uuid : string ;
59+ index : string ;
60+ caused_by : {
61+ type : string ;
62+ reason : string ;
63+ } ;
64+ } ;
65+ }
66+
67+ export interface SearchResponse < T > {
68+ took : number ;
69+ timed_out : boolean ;
70+ _scroll_id ?: string ;
71+ _shards : ShardsResponse ;
72+ hits : {
73+ total : TotalValue | number ;
74+ max_score : number ;
75+ hits : Array <
76+ BaseHit < T > & {
77+ _type : string ;
78+ _score : number ;
79+ _version ?: number ;
80+ _explanation ?: Explanation ;
81+ fields ?: string [ ] ;
82+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
83+ highlight ?: any ;
84+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
85+ inner_hits ?: any ;
86+ matched_queries ?: string [ ] ;
87+ sort ?: string [ ] ;
88+ }
89+ > ;
90+ } ;
91+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
92+ aggregations ?: any ;
93+ }
94+
95+ export type SearchHit = SearchResponse < object > [ 'hits' ] [ 'hits' ] [ 0 ] ;
96+
4297export interface TermAggregation {
4398 [ agg : string ] : {
4499 buckets : Array < {
You can’t perform that action at this time.
0 commit comments