@@ -58,7 +58,7 @@ test('bulk index', t => {
58
58
onRequest ( params ) {
59
59
t . equal ( params . path , '/_bulk' )
60
60
t . match ( params . headers , {
61
- 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' ,
61
+ 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' ,
62
62
'x-elastic-client-meta' : `es=${ clientVersion } ,js=${ nodeVersion } ,t=${ transportVersion } ,hc=${ nodeVersion } ,h=bp`
63
63
} )
64
64
// @ts -expect-error
@@ -104,7 +104,7 @@ test('bulk index', t => {
104
104
const MockConnection = connection . buildMockConnection ( {
105
105
onRequest ( params ) {
106
106
t . equal ( params . path , '/_bulk' )
107
- t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
107
+ t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
108
108
t . notMatch ( params . headers , {
109
109
'x-elastic-client-meta' : `es=${ clientVersion } ,js=${ nodeVersion } ,t=${ transportVersion } ,hc=${ nodeVersion } ,h=bp`
110
110
} )
@@ -150,7 +150,7 @@ test('bulk index', t => {
150
150
const MockConnection = connection . buildMockConnection ( {
151
151
onRequest ( params ) {
152
152
t . equal ( params . path , '/_bulk' )
153
- t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
153
+ t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
154
154
// @ts -expect-error
155
155
t . equal ( params . body . split ( '\n' ) . filter ( Boolean ) . length , 6 )
156
156
return { body : { errors : false , items : new Array ( 3 ) . fill ( { } ) } }
@@ -195,7 +195,7 @@ test('bulk index', t => {
195
195
return { body : { acknowledged : true } }
196
196
} else {
197
197
t . equal ( params . path , '/_bulk' )
198
- t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
198
+ t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
199
199
// @ts -expect-error
200
200
const [ action , payload ] = params . body . split ( '\n' )
201
201
t . same ( JSON . parse ( action ) , { index : { _index : 'test' } } )
@@ -241,7 +241,7 @@ test('bulk index', t => {
241
241
return { body : { acknowledged : true } }
242
242
} else {
243
243
t . equal ( params . path , '/_bulk' )
244
- t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
244
+ t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
245
245
// @ts -expect-error
246
246
const [ action , payload ] = params . body . split ( '\n' )
247
247
t . same ( JSON . parse ( action ) , { index : { _index : 'test' } } )
@@ -283,7 +283,7 @@ test('bulk index', t => {
283
283
const MockConnection = connection . buildMockConnection ( {
284
284
onRequest ( params ) {
285
285
t . equal ( params . path , '/_bulk' )
286
- t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
286
+ t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
287
287
// @ts -expect-error
288
288
const [ action , payload ] = params . body . split ( '\n' )
289
289
t . same ( JSON . parse ( action ) , { index : { _index : 'test' , _id : count } } )
@@ -328,7 +328,7 @@ test('bulk index', t => {
328
328
t . test ( 'Should perform a bulk request (retry)' , async t => {
329
329
async function handler ( req : http . IncomingMessage , res : http . ServerResponse ) {
330
330
t . equal ( req . url , '/_bulk' )
331
- t . match ( req . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
331
+ t . match ( req . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
332
332
333
333
let body = ''
334
334
req . setEncoding ( 'utf8' )
@@ -446,7 +446,7 @@ test('bulk index', t => {
446
446
t . test ( 'Should perform a bulk request (failure)' , async t => {
447
447
async function handler ( req : http . IncomingMessage , res : http . ServerResponse ) {
448
448
t . equal ( req . url , '/_bulk' )
449
- t . match ( req . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
449
+ t . match ( req . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
450
450
451
451
let body = ''
452
452
req . setEncoding ( 'utf8' )
@@ -587,7 +587,7 @@ test('bulk index', t => {
587
587
t . test ( 'Should abort a bulk request' , async t => {
588
588
async function handler ( req : http . IncomingMessage , res : http . ServerResponse ) {
589
589
t . equal ( req . url , '/_bulk' )
590
- t . match ( req . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
590
+ t . match ( req . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
591
591
592
592
let body = ''
593
593
req . setEncoding ( 'utf8' )
@@ -724,7 +724,7 @@ test('bulk index', t => {
724
724
const MockConnection = connection . buildMockConnection ( {
725
725
onRequest ( params ) {
726
726
t . equal ( params . path , '/_bulk' )
727
- t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
727
+ t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
728
728
// @ts -expect-error
729
729
const [ action , payload ] = params . body . split ( '\n' )
730
730
t . same ( JSON . parse ( action ) , { index : { _index : 'test' , _id : count } } )
@@ -815,7 +815,7 @@ test('bulk index', t => {
815
815
const MockConnection = connection . buildMockConnection ( {
816
816
onRequest ( params ) {
817
817
t . equal ( params . path , '/_bulk' )
818
- t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
818
+ t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
819
819
// @ts -expect-error
820
820
const [ action , payload ] = params . body . split ( '\n' )
821
821
t . same ( JSON . parse ( action ) , { index : { _index : 'test' } } )
@@ -914,7 +914,7 @@ test('bulk index', t => {
914
914
onRequest ( params ) {
915
915
t . equal ( params . path , '/_bulk' )
916
916
t . match ( params . headers , {
917
- 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' ,
917
+ 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' ,
918
918
'x-elastic-client-meta' : `es=${ clientVersion } ,js=${ nodeVersion } ,t=${ transportVersion } ,hc=${ nodeVersion } ,h=bp`
919
919
} )
920
920
// @ts -expect-error
@@ -969,7 +969,7 @@ test('bulk create', t => {
969
969
const MockConnection = connection . buildMockConnection ( {
970
970
onRequest ( params ) {
971
971
t . equal ( params . path , '/_bulk' )
972
- t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
972
+ t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
973
973
// @ts -expect-error
974
974
const [ action , payload ] = params . body . split ( '\n' )
975
975
t . same ( JSON . parse ( action ) , { create : { _index : 'test' , _id : count } } )
@@ -1017,7 +1017,7 @@ test('bulk create', t => {
1017
1017
const MockConnection = connection . buildMockConnection ( {
1018
1018
onRequest ( params ) {
1019
1019
t . equal ( params . path , '/_bulk' )
1020
- t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
1020
+ t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
1021
1021
// @ts -expect-error
1022
1022
const [ action , payload ] = params . body . split ( '\n' )
1023
1023
t . same ( JSON . parse ( action ) , { create : { _index : 'test' , _id : count } } )
@@ -1073,7 +1073,7 @@ test('bulk update', t => {
1073
1073
const MockConnection = connection . buildMockConnection ( {
1074
1074
onRequest ( params ) {
1075
1075
t . equal ( params . path , '/_bulk' )
1076
- t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
1076
+ t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
1077
1077
// @ts -expect-error
1078
1078
const [ action , payload ] = params . body . split ( '\n' )
1079
1079
t . same ( JSON . parse ( action ) , { update : { _index : 'test' , _id : count } } )
@@ -1122,7 +1122,7 @@ test('bulk update', t => {
1122
1122
const MockConnection = connection . buildMockConnection ( {
1123
1123
onRequest ( params ) {
1124
1124
t . equal ( params . path , '/_bulk' )
1125
- t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
1125
+ t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
1126
1126
// @ts -expect-error
1127
1127
const [ action , payload ] = params . body . split ( '\n' )
1128
1128
t . same ( JSON . parse ( action ) , { update : { _index : 'test' , _id : count } } )
@@ -1169,7 +1169,7 @@ test('bulk update', t => {
1169
1169
const MockConnection = connection . buildMockConnection ( {
1170
1170
onRequest ( params ) {
1171
1171
t . equal ( params . path , '/_bulk' )
1172
- t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
1172
+ t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
1173
1173
// @ts -expect-error
1174
1174
const [ action , payload ] = params . body . split ( '\n' )
1175
1175
t . same ( JSON . parse ( action ) , { update : { _index : 'test' , _id : count } } )
@@ -1223,7 +1223,7 @@ test('bulk delete', t => {
1223
1223
const MockConnection = connection . buildMockConnection ( {
1224
1224
onRequest ( params ) {
1225
1225
t . equal ( params . path , '/_bulk' )
1226
- t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
1226
+ t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
1227
1227
// @ts -expect-error
1228
1228
t . same ( JSON . parse ( params . body ) , { delete : { _index : 'test' , _id : count ++ } } )
1229
1229
return { body : { errors : false , items : [ { } ] } }
@@ -1266,7 +1266,7 @@ test('bulk delete', t => {
1266
1266
t . test ( 'Should perform a bulk request (failure)' , async t => {
1267
1267
async function handler ( req : http . IncomingMessage , res : http . ServerResponse ) {
1268
1268
t . equal ( req . url , '/_bulk' )
1269
- t . match ( req . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
1269
+ t . match ( req . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
1270
1270
1271
1271
let body = ''
1272
1272
req . setEncoding ( 'utf8' )
@@ -1469,7 +1469,7 @@ test('transport options', t => {
1469
1469
1470
1470
if ( params . path === '/_bulk' ) {
1471
1471
t . match ( params . headers , {
1472
- 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' ,
1472
+ 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' ,
1473
1473
foo : 'bar'
1474
1474
} )
1475
1475
return { body : { errors : false , items : [ { } ] } }
@@ -1618,7 +1618,7 @@ test('Flush interval', t => {
1618
1618
const MockConnection = connection . buildMockConnection ( {
1619
1619
onRequest ( params ) {
1620
1620
t . equal ( params . path , '/_bulk' )
1621
- t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
1621
+ t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
1622
1622
// @ts -expect-error
1623
1623
const [ action , payload ] = params . body . split ( '\n' )
1624
1624
t . same ( JSON . parse ( action ) , { index : { _index : 'test' } } )
@@ -1671,7 +1671,7 @@ test('Flush interval', t => {
1671
1671
onRequest ( params ) {
1672
1672
t . ok ( count < 2 )
1673
1673
t . equal ( params . path , '/_bulk' )
1674
- t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' } )
1674
+ t . match ( params . headers , { 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' } )
1675
1675
// @ts -expect-error
1676
1676
const [ action , payload ] = params . body . split ( '\n' )
1677
1677
t . same ( JSON . parse ( action ) , { index : { _index : 'test' } } )
@@ -1730,7 +1730,7 @@ test('Flush interval', t => {
1730
1730
onRequest ( params ) {
1731
1731
t . equal ( params . path , '/_bulk' )
1732
1732
t . match ( params . headers , {
1733
- 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8 ' ,
1733
+ 'content-type' : 'application/vnd.elasticsearch+x-ndjson; compatible-with=9 ' ,
1734
1734
'x-elastic-client-meta' : `es=${ clientVersion } ,js=${ nodeVersion } ,t=${ transportVersion } ,hc=${ nodeVersion } ,h=bp`
1735
1735
} )
1736
1736
// @ts -expect-error
@@ -1749,12 +1749,12 @@ test('Flush interval', t => {
1749
1749
datasource : dataset . slice ( ) ,
1750
1750
flushBytes : 1 ,
1751
1751
concurrency : 1 ,
1752
- onDocument ( doc ) {
1752
+ onDocument ( _doc ) {
1753
1753
return {
1754
1754
index : { _index : 'test' }
1755
1755
}
1756
1756
} ,
1757
- onDrop ( doc ) {
1757
+ onDrop ( _doc ) {
1758
1758
t . fail ( 'This should never be called' )
1759
1759
}
1760
1760
} )
0 commit comments