@@ -270,8 +270,13 @@ public void testFieldTypeWithDocValuesSkipper_LogsDBMode() throws IOException {
270270 .mappers ()
271271 .getMapper (DataStreamTimestampFieldMapper .DEFAULT_PATH );
272272 assertTrue (timestampMapper .fieldType ().hasDocValues ());
273- assertTrue (timestampMapper .fieldType ().hasDocValuesSkipper ());
274- assertFalse (timestampMapper .fieldType ().isIndexed ());
273+ if (IndexSettings .USE_DOC_VALUES_SKIPPER .get (settings )) {
274+ assertFalse (timestampMapper .fieldType ().isIndexed ());
275+ assertTrue (timestampMapper .fieldType ().hasDocValuesSkipper ());
276+ } else {
277+ assertTrue (timestampMapper .fieldType ().isIndexed ());
278+ assertFalse (timestampMapper .fieldType ().hasDocValuesSkipper ());
279+ }
275280 }
276281
277282 public void testFieldTypeWithDocValuesSkipper_LogsDBModeExplicitTimestampIndexEnabledDocValuesSkipper () throws IOException {
@@ -290,9 +295,13 @@ public void testFieldTypeWithDocValuesSkipper_LogsDBModeExplicitTimestampIndexEn
290295 .mappers ()
291296 .getMapper (DataStreamTimestampFieldMapper .DEFAULT_PATH );
292297 assertTrue (timestampMapper .fieldType ().hasDocValues ());
293- // NOTE: setting `index.mapping.use_doc_values_skipper` true overrides `index` for @timestamp in LogsDB
294- assertTrue (timestampMapper .fieldType ().hasDocValuesSkipper ());
295- assertFalse (timestampMapper .fieldType ().isIndexed ());
298+ if (IndexSettings .USE_DOC_VALUES_SKIPPER .get (settings )) {
299+ assertFalse (timestampMapper .fieldType ().isIndexed ());
300+ assertTrue (timestampMapper .fieldType ().hasDocValuesSkipper ());
301+ } else {
302+ assertTrue (timestampMapper .fieldType ().isIndexed ());
303+ assertFalse (timestampMapper .fieldType ().hasDocValuesSkipper ());
304+ }
296305 }
297306
298307 public void testFieldTypeWithDocValuesSkipper_LogsDBModeExplicitTimestampIndexDisabledDocValuesSkipper () throws IOException {
@@ -304,7 +313,7 @@ public void testFieldTypeWithDocValuesSkipper_LogsDBModeExplicitTimestampIndexDi
304313 final MapperService mapperService = createMapperService (settings , timestampMapping (true , b -> {
305314 b .startObject (DataStreamTimestampFieldMapper .DEFAULT_PATH );
306315 b .field ("type" , "date" );
307- b .field ("index" , true ); // NOTE: setting `index.mapping.use_doc_values_skipper` false does not override `index`
316+ b .field ("index" , true );
308317 b .endObject ();
309318 }));
310319
@@ -334,8 +343,13 @@ public void testFieldTypeWithDocValuesSkipper_LogsDBModeWithoutDefaultMapping()
334343 .mappers ()
335344 .getMapper (DataStreamTimestampFieldMapper .DEFAULT_PATH );
336345 assertTrue (timestampMapper .fieldType ().hasDocValues ());
337- assertFalse (timestampMapper .fieldType ().isIndexed ());
338- assertTrue (timestampMapper .fieldType ().hasDocValuesSkipper ());
346+ if (IndexSettings .USE_DOC_VALUES_SKIPPER .get (settings )) {
347+ assertFalse (timestampMapper .fieldType ().isIndexed ());
348+ assertTrue (timestampMapper .fieldType ().hasDocValuesSkipper ());
349+ } else {
350+ assertTrue (timestampMapper .fieldType ().isIndexed ());
351+ assertFalse (timestampMapper .fieldType ().hasDocValuesSkipper ());
352+ }
339353 }
340354
341355 public void testFieldTypeWithDocValuesSkipper_DocValuesFalseEnabledDocValuesSkipper () {
@@ -398,8 +412,13 @@ public void testFieldTypeWithDocValuesSkipper_WithoutTimestampSorting() throws I
398412 .getMapper (DataStreamTimestampFieldMapper .DEFAULT_PATH );
399413 assertTrue (timestampMapper .fieldType ().hasDocValues ());
400414 // NOTE: in LogsDB we always sort on @timestamp (and maybe also on host.name) by default
401- assertFalse (timestampMapper .fieldType ().isIndexed ());
402- assertTrue (timestampMapper .fieldType ().hasDocValuesSkipper ());
415+ if (IndexSettings .USE_DOC_VALUES_SKIPPER .get (settings )) {
416+ assertFalse (timestampMapper .fieldType ().isIndexed ());
417+ assertTrue (timestampMapper .fieldType ().hasDocValuesSkipper ());
418+ } else {
419+ assertTrue (timestampMapper .fieldType ().isIndexed ());
420+ assertFalse (timestampMapper .fieldType ().hasDocValuesSkipper ());
421+ }
403422 }
404423
405424 public void testFieldTypeWithDocValuesSkipper_StandardMode () throws IOException {
@@ -439,7 +458,12 @@ public void testFieldTypeWithDocValuesSkipper_CustomTimestampField() throws IOEx
439458 // Default LogsDB mapping including @timestamp field is used
440459 final DateFieldMapper defaultTimestamp = (DateFieldMapper ) mapperService .documentMapper ().mappers ().getMapper ("@timestamp" );
441460 assertTrue (defaultTimestamp .fieldType ().hasDocValues ());
442- assertFalse (defaultTimestamp .fieldType ().isIndexed ());
443- assertTrue (defaultTimestamp .fieldType ().hasDocValuesSkipper ());
461+ if (IndexSettings .USE_DOC_VALUES_SKIPPER .get (settings )) {
462+ assertFalse (defaultTimestamp .fieldType ().isIndexed ());
463+ assertTrue (defaultTimestamp .fieldType ().hasDocValuesSkipper ());
464+ } else {
465+ assertTrue (defaultTimestamp .fieldType ().isIndexed ());
466+ assertFalse (defaultTimestamp .fieldType ().hasDocValuesSkipper ());
467+ }
444468 }
445469}
0 commit comments