|
10 | 10 | package org.elasticsearch.index.mapper; |
11 | 11 |
|
12 | 12 | import org.apache.lucene.document.SortedDocValuesField; |
| 13 | +import org.apache.lucene.document.SortedSetDocValuesField; |
13 | 14 | import org.apache.lucene.index.DirectoryReader; |
14 | 15 | import org.apache.lucene.index.IndexWriter; |
15 | 16 | import org.apache.lucene.index.IndexWriterConfig; |
@@ -70,13 +71,19 @@ public void doTestManyValues(String fieldName, Class<?> expectedColumnReader) th |
70 | 71 | int uniqueTsidEvery = 200; |
71 | 72 | IndexWriterConfig iwc = new IndexWriterConfig(new MockAnalyzer(random())); |
72 | 73 | iwc.setLeafSorter(DataStream.TIMESERIES_LEAF_READERS_SORTER); |
73 | | - iwc.setIndexSort(new Sort(new SortField(fieldName, SortField.Type.STRING, false))); |
| 74 | + if (fieldName.equals(TimeSeriesIdFieldMapper.NAME)) { |
| 75 | + iwc.setIndexSort(new Sort(new SortField(fieldName, SortField.Type.STRING, false))); |
| 76 | + } |
74 | 77 | iwc.setCodec(TestUtil.alwaysDocValuesFormat(new ES819TSDBDocValuesFormat())); |
75 | 78 | try (IndexWriter iw = new IndexWriter(directory, iwc)) { |
76 | 79 | for (int i = from; i < to; i++) { |
77 | 80 | LuceneDocument doc = new LuceneDocument(); |
78 | 81 | int tsid = i / uniqueTsidEvery; |
79 | | - doc.add(new SortedDocValuesField(fieldName, new BytesRef(String.format(Locale.ROOT, "%04d", tsid)))); |
| 82 | + if (fieldName.equals(TimeSeriesIdFieldMapper.NAME)) { |
| 83 | + doc.add(new SortedDocValuesField(fieldName, new BytesRef(String.format(Locale.ROOT, "%04d", tsid)))); |
| 84 | + } else { |
| 85 | + doc.add(new SortedSetDocValuesField(fieldName, new BytesRef(String.format(Locale.ROOT, "%04d", tsid)))); |
| 86 | + } |
80 | 87 | iw.addDocument(doc); |
81 | 88 | } |
82 | 89 | iw.forceMerge(1); |
|
0 commit comments