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';
1616import configPostHandler from '../handlers/config/post' ;
1717import metadataHandler from '../handlers/metadata/get' ;
1818import mappingHandler from '../handlers/mapping/get' ;
19+ import searchHandler from '../handlers/search/get' ;
1920
2021/**
2122 * A server route.
@@ -86,6 +87,11 @@ let routes = [
8687 path : 'mapping/:index' ,
8788 method : [ 'GET' ] ,
8889 handler : [ mappingHandler ]
90+ } ,
91+ {
92+ path : 'search/:index' ,
93+ method : [ 'POST' ] ,
94+ handler : [ searchHandler ]
8995 }
9096] ;
9197
You can’t perform that action at this time.
0 commit comments