File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { getClient } from '../../common/elasticsearch_client' ;
2
+
3
+ export default function searchHandler ( request , response ) {
4
+ /**
5
+ * @type {ElastalertServer }
6
+ */
7
+ var client = getClient ( ) ;
8
+
9
+ client . search ( {
10
+ index : request . params . index ,
11
+ body : request . body
12
+ } ) . then ( function ( resp ) {
13
+ response . send ( resp ) ;
14
+ } , function ( error ) {
15
+ response . send ( { error } ) ;
16
+ } ) ;
17
+
18
+ }
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import configGetHandler from '../handlers/config/get';
16
16
import configPostHandler from '../handlers/config/post' ;
17
17
import metadataHandler from '../handlers/metadata/get' ;
18
18
import mappingHandler from '../handlers/mapping/get' ;
19
+ import searchHandler from '../handlers/search/get' ;
19
20
20
21
/**
21
22
* A server route.
@@ -86,6 +87,11 @@ let routes = [
86
87
path : 'mapping/:index' ,
87
88
method : [ 'GET' ] ,
88
89
handler : [ mappingHandler ]
90
+ } ,
91
+ {
92
+ path : 'search/:index' ,
93
+ method : [ 'POST' ] ,
94
+ handler : [ searchHandler ]
89
95
}
90
96
] ;
91
97
You can’t perform that action at this time.
0 commit comments