File tree Expand file tree Collapse file tree 4 files changed +10
-1
lines changed Expand file tree Collapse file tree 4 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -270,6 +270,10 @@ let ret = await demoIndex
270
270
``` js
271
271
instance .set (" log" ,console .log );
272
272
```
273
+ 设置请求超时时间,以毫秒为单位(默认是30s)
274
+ ``` js
275
+ instance .set (' timeout' ,5000 );
276
+ ```
273
277
## 查询API
274
278
### 文本匹配
275
279
#### match 查询
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " elasticsearch-orm" ,
3
- "version" : " 1.0.18 " ,
3
+ "version" : " 1.0.19 " ,
4
4
"description" : " This is a orm for elasticSearch" ,
5
5
"main" : " es.js" ,
6
6
"scripts" : {
Original file line number Diff line number Diff line change 1
1
const map = new Map ( ) ;
2
2
map . set ( 'scroll' , '1m' ) ;
3
+ map . set ( 'timeout' , 30 * 1000 ) ;
3
4
module . exports = map ;
Original file line number Diff line number Diff line change @@ -12,7 +12,11 @@ const initContentType = (opts) => {
12
12
module . exports = ( opts ) => {
13
13
const DEBUG = config . get ( 'debug' ) ;
14
14
const log = config . get ( "log" ) || console . log ;
15
+ const TIMEOUT = config . get ( 'timeout' ) ;
15
16
initContentType ( opts ) ;
17
+ if ( ! opts . timeout ) {
18
+ opts . timeout = TIMEOUT ;
19
+ }
16
20
let logArr = [ ] ;
17
21
return new Promise ( ( resolve , reject ) => {
18
22
if ( DEBUG ) {
You can’t perform that action at this time.
0 commit comments