1
0
Эх сурвалжийг харах

Cleanup some Dead Code in Mappers (#80526)

Just cleaning up some unused code in the mapper package
in preparation for some further deduplication/scalability
improvements.
Armin Braun 4 жил өмнө
parent
commit
01a144a60b
63 өөрчлөгдсөн 98 нэмэгдсэн , 364 устгасан
  1. 1 1
      modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java
  2. 1 1
      modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/RankFeatureMetaFieldMapperTests.java
  3. 0 9
      modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/ScaledFloatFieldMapperTests.java
  4. 1 2
      modules/parent-join/src/test/java/org/elasticsearch/join/mapper/ParentJoinFieldMapperTests.java
  5. 1 1
      modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateQueryBuilder.java
  6. 1 22
      modules/percolator/src/test/java/org/elasticsearch/percolator/PercolatorFieldMapperTests.java
  7. 1 1
      plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/ICUCollationKeywordFieldMapperTests.java
  8. 2 2
      server/src/internalClusterTest/java/org/elasticsearch/index/shard/IndexShardIT.java
  9. 0 4
      server/src/main/java/org/elasticsearch/action/bulk/TransportShardBulkAction.java
  10. 1 1
      server/src/main/java/org/elasticsearch/index/IndexService.java
  11. 0 1
      server/src/main/java/org/elasticsearch/index/engine/TranslogDirectoryReader.java
  12. 1 5
      server/src/main/java/org/elasticsearch/index/mapper/CustomTermFreqField.java
  13. 4 10
      server/src/main/java/org/elasticsearch/index/mapper/DataStreamTimestampFieldMapper.java
  14. 1 17
      server/src/main/java/org/elasticsearch/index/mapper/DateFieldMapper.java
  15. 0 21
      server/src/main/java/org/elasticsearch/index/mapper/DocumentParserContext.java
  16. 2 50
      server/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java
  17. 0 1
      server/src/main/java/org/elasticsearch/index/mapper/IdFieldMapper.java
  18. 1 2
      server/src/main/java/org/elasticsearch/index/mapper/IndexFieldMapper.java
  19. 1 1
      server/src/main/java/org/elasticsearch/index/mapper/KeywordFieldMapper.java
  20. 1 5
      server/src/main/java/org/elasticsearch/index/mapper/MapperService.java
  21. 0 4
      server/src/main/java/org/elasticsearch/index/mapper/MappingParserContext.java
  22. 0 13
      server/src/main/java/org/elasticsearch/index/mapper/RangeType.java
  23. 2 15
      server/src/main/java/org/elasticsearch/index/mapper/SourceToParse.java
  24. 1 1
      server/src/main/java/org/elasticsearch/index/mapper/TextFieldMapper.java
  25. 0 16
      server/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java
  26. 0 1
      server/src/main/java/org/elasticsearch/index/mapper/Uid.java
  27. 4 6
      server/src/main/java/org/elasticsearch/index/mapper/flattened/FlattenedFieldMapper.java
  28. 1 8
      server/src/main/java/org/elasticsearch/index/shard/IndexShard.java
  29. 1 8
      server/src/main/java/org/elasticsearch/index/termvectors/TermVectorsService.java
  30. 4 4
      server/src/test/java/org/elasticsearch/index/fielddata/BinaryDVFieldDataTests.java
  31. 1 1
      server/src/test/java/org/elasticsearch/index/mapper/BooleanScriptFieldTypeTests.java
  32. 5 5
      server/src/test/java/org/elasticsearch/index/mapper/CopyToMapperTests.java
  33. 4 4
      server/src/test/java/org/elasticsearch/index/mapper/DocumentParserTests.java
  34. 1 1
      server/src/test/java/org/elasticsearch/index/mapper/DynamicMappingTests.java
  35. 0 1
      server/src/test/java/org/elasticsearch/index/mapper/DynamicTemplatesTests.java
  36. 0 1
      server/src/test/java/org/elasticsearch/index/mapper/FieldNamesFieldMapperTests.java
  37. 2 2
      server/src/test/java/org/elasticsearch/index/mapper/JavaMultiFieldMergeTests.java
  38. 2 2
      server/src/test/java/org/elasticsearch/index/mapper/MultiFieldTests.java
  39. 8 20
      server/src/test/java/org/elasticsearch/index/mapper/NestedObjectMapperTests.java
  40. 1 1
      server/src/test/java/org/elasticsearch/index/mapper/NestedPathFieldMapperTests.java
  41. 0 3
      server/src/test/java/org/elasticsearch/index/mapper/NullValueObjectMappingTests.java
  42. 0 1
      server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperTests.java
  43. 1 2
      server/src/test/java/org/elasticsearch/index/mapper/PathMatchDynamicTemplateTests.java
  44. 0 1
      server/src/test/java/org/elasticsearch/index/mapper/RoutingFieldMapperTests.java
  45. 1 3
      server/src/test/java/org/elasticsearch/index/mapper/SourceFieldMapperTests.java
  46. 0 1
      server/src/test/java/org/elasticsearch/index/mapper/StoredNumericValuesTests.java
  47. 1 1
      server/src/test/java/org/elasticsearch/index/mapper/flattened/FlattenedFieldMapperTests.java
  48. 2 2
      server/src/test/java/org/elasticsearch/index/replication/RecoveryDuringReplicationTests.java
  49. 10 15
      server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java
  50. 2 2
      server/src/test/java/org/elasticsearch/index/shard/PrimaryReplicaSyncerTests.java
  51. 1 1
      server/src/test/java/org/elasticsearch/indices/recovery/PeerRecoveryTargetServiceTests.java
  52. 5 5
      server/src/test/java/org/elasticsearch/indices/recovery/RecoveryTests.java
  53. 3 11
      server/src/test/java/org/elasticsearch/search/suggest/completion/CategoryContextMappingTests.java
  54. 1 4
      server/src/test/java/org/elasticsearch/search/suggest/completion/GeoContextMappingTests.java
  55. 1 1
      test/framework/src/main/java/org/elasticsearch/index/engine/EngineTestCase.java
  56. 1 8
      test/framework/src/main/java/org/elasticsearch/index/engine/TranslogHandler.java
  57. 2 2
      test/framework/src/main/java/org/elasticsearch/index/mapper/MapperServiceTestCase.java
  58. 1 8
      test/framework/src/main/java/org/elasticsearch/index/shard/IndexShardTestCase.java
  59. 2 7
      x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/index/engine/FollowEngineIndexShardTests.java
  60. 1 8
      x-pack/plugin/core/src/test/java/org/elasticsearch/snapshots/sourceonly/SourceOnlySnapshotShardTests.java
  61. 2 3
      x-pack/plugin/mapper-version/src/test/java/org/elasticsearch/xpack/versionfield/VersionStringFieldMapperTests.java
  62. 3 3
      x-pack/plugin/spatial/src/test/java/org/elasticsearch/xpack/spatial/index/mapper/GeoShapeWithDocValuesFieldMapperTests.java
  63. 1 1
      x-pack/plugin/vectors/src/internalClusterTest/java/org/elasticsearch/xpack/vectors/mapper/SparseVectorFieldMapperTests.java

+ 1 - 1
modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java

@@ -709,7 +709,7 @@ public class PainlessExecuteAction extends ActionType<PainlessExecuteAction.Resp
                     String index = indexService.index().getName();
                     BytesReference document = request.contextSetup.document;
                     XContentType xContentType = request.contextSetup.xContentType;
-                    SourceToParse sourceToParse = new SourceToParse(index, "_id", document, xContentType);
+                    SourceToParse sourceToParse = new SourceToParse("_id", document, xContentType);
                     MappingLookup mappingLookup = indexService.mapperService().mappingLookup();
                     DocumentParser documentParser = indexService.mapperService().documentParser();
                     // Note that we are not doing anything with dynamic mapping updates, hence fields that are not mapped but are present

+ 1 - 1
modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/RankFeatureMetaFieldMapperTests.java

@@ -66,7 +66,7 @@ public class RankFeatureMetaFieldMapperTests extends MapperServiceTestCase {
         BytesReference bytes = BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field(rfMetaField, 0).endObject());
         MapperParsingException e = expectThrows(
             MapperParsingException.class,
-            () -> mapper.parse(new SourceToParse("test", "1", bytes, XContentType.JSON))
+            () -> mapper.parse(new SourceToParse("1", bytes, XContentType.JSON))
         );
         assertThat(
             e.getCause().getMessage(),

+ 0 - 9
modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/ScaledFloatFieldMapperTests.java

@@ -116,7 +116,6 @@ public class ScaledFloatFieldMapperTests extends MapperTestCase {
 
         ParsedDocument doc = mapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field("field", 123).endObject()),
                 XContentType.JSON
@@ -137,7 +136,6 @@ public class ScaledFloatFieldMapperTests extends MapperTestCase {
 
         ParsedDocument doc = mapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field("field", 123).endObject()),
                 XContentType.JSON
@@ -158,7 +156,6 @@ public class ScaledFloatFieldMapperTests extends MapperTestCase {
 
         ParsedDocument doc = mapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field("field", 123).endObject()),
                 XContentType.JSON
@@ -181,7 +178,6 @@ public class ScaledFloatFieldMapperTests extends MapperTestCase {
         DocumentMapper mapper = createDocumentMapper(fieldMapping(this::minimalMapping));
         ParsedDocument doc = mapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field("field", "123").endObject()),
                 XContentType.JSON
@@ -200,7 +196,6 @@ public class ScaledFloatFieldMapperTests extends MapperTestCase {
         );
         ThrowingRunnable runnable = () -> mapper2.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field("field", "123").endObject()),
                 XContentType.JSON
@@ -223,7 +218,6 @@ public class ScaledFloatFieldMapperTests extends MapperTestCase {
         DocumentMapper mapper = createDocumentMapper(fieldMapping(this::minimalMapping));
         ThrowingRunnable runnable = () -> mapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field("field", value).endObject()),
                 XContentType.JSON
@@ -237,7 +231,6 @@ public class ScaledFloatFieldMapperTests extends MapperTestCase {
         );
         ParsedDocument doc = mapper2.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field("field", value).endObject()),
                 XContentType.JSON
@@ -252,7 +245,6 @@ public class ScaledFloatFieldMapperTests extends MapperTestCase {
         DocumentMapper mapper = createDocumentMapper(fieldMapping(this::minimalMapping));
         ParsedDocument doc = mapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(XContentFactory.jsonBuilder().startObject().nullField("field").endObject()),
                 XContentType.JSON
@@ -265,7 +257,6 @@ public class ScaledFloatFieldMapperTests extends MapperTestCase {
         );
         doc = mapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(XContentFactory.jsonBuilder().startObject().nullField("field").endObject()),
                 XContentType.JSON

+ 1 - 2
modules/parent-join/src/test/java/org/elasticsearch/join/mapper/ParentJoinFieldMapperTests.java

@@ -102,7 +102,7 @@ public class ParentJoinFieldMapperTests extends MapperServiceTestCase {
 
         // Doc without join
         ParsedDocument doc = docMapper.parse(
-            new SourceToParse("test", "0", BytesReference.bytes(XContentFactory.jsonBuilder().startObject().endObject()), XContentType.JSON)
+            new SourceToParse("0", BytesReference.bytes(XContentFactory.jsonBuilder().startObject().endObject()), XContentType.JSON)
         );
         assertNull(doc.rootDoc().getBinaryValue("join_field"));
 
@@ -143,7 +143,6 @@ public class ParentJoinFieldMapperTests extends MapperServiceTestCase {
             MapperParsingException.class,
             () -> docMapper.parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field("join_field", "unknown").endObject()),
                     XContentType.JSON

+ 1 - 1
modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateQueryBuilder.java

@@ -503,7 +503,7 @@ public class PercolateQueryBuilder extends AbstractQueryBuilder<PercolateQueryBu
 
         final List<ParsedDocument> docs = new ArrayList<>();
         for (BytesReference document : documents) {
-            docs.add(context.parseDocument(new SourceToParse(context.index().getName(), "_temp_id", document, documentXContentType)));
+            docs.add(context.parseDocument(new SourceToParse("_temp_id", document, documentXContentType)));
         }
 
         // We need this custom analyzer because the default index analyzer is strict and the percolator sometimes isn't when

+ 1 - 22
modules/percolator/src/test/java/org/elasticsearch/percolator/PercolatorFieldMapperTests.java

@@ -473,7 +473,6 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase {
         ParsedDocument doc = mapperService.documentMapper()
             .parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field(fieldName, queryBuilder).endObject()),
                     XContentType.JSON
@@ -493,7 +492,6 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase {
         doc = mapperService.documentMapper()
             .parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field(fieldName, queryBuilder).endObject()),
                     XContentType.JSON
@@ -510,7 +508,6 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase {
         doc = mapperService.documentMapper()
             .parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field(fieldName, queryBuilder).endObject()),
                     XContentType.JSON
@@ -538,7 +535,6 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase {
             ParsedDocument doc = mapperService.documentMapper()
                 .parse(
                     new SourceToParse(
-                        "test",
                         "1",
                         BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field(fieldName, query).endObject()),
                         XContentType.JSON
@@ -556,7 +552,6 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase {
         ParsedDocument doc = mapperService.documentMapper()
             .parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field(fieldName, queryBuilder).endObject()),
                     XContentType.JSON
@@ -582,7 +577,6 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase {
             mapperService.documentMapper()
                 .parse(
                     new SourceToParse(
-                        "test",
                         "1",
                         BytesReference.bytes(
                             XContentFactory.jsonBuilder().startObject().field(fieldName, termQuery("unmapped_field", "value")).endObject()
@@ -599,12 +593,7 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase {
         addQueryFieldMappings();
         ParsedDocument doc = mapperService.documentMapper()
             .parse(
-                new SourceToParse(
-                    "test",
-                    "1",
-                    BytesReference.bytes(XContentFactory.jsonBuilder().startObject().endObject()),
-                    XContentType.JSON
-                )
+                new SourceToParse("1", BytesReference.bytes(XContentFactory.jsonBuilder().startObject().endObject()), XContentType.JSON)
             );
         assertThat(doc.rootDoc().getFields(fieldType.queryBuilderField.name()).length, equalTo(0));
 
@@ -612,7 +601,6 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase {
             mapperService.documentMapper()
                 .parse(
                     new SourceToParse(
-                        "test",
                         "1",
                         BytesReference.bytes(XContentFactory.jsonBuilder().startObject().nullField(fieldName).endObject()),
                         XContentType.JSON
@@ -672,7 +660,6 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase {
         ParsedDocument doc = mapperService.documentMapper()
             .parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     BytesReference.bytes(
                         jsonBuilder().startObject().field("query_field1", queryBuilder).field("query_field2", queryBuilder).endObject()
@@ -714,7 +701,6 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase {
         ParsedDocument doc = mapperService.documentMapper()
             .parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     BytesReference.bytes(
                         jsonBuilder().startObject().startObject("object_field").field("query_field", queryBuilder).endObject().endObject()
@@ -733,7 +719,6 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase {
         doc = mapperService.documentMapper()
             .parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     BytesReference.bytes(
                         jsonBuilder().startObject()
@@ -755,7 +740,6 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase {
             mapperService.documentMapper()
                 .parse(
                     new SourceToParse(
-                        "test",
                         "1",
                         BytesReference.bytes(
                             jsonBuilder().startObject()
@@ -860,7 +844,6 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase {
         ParsedDocument doc = mapperService.documentMapper()
             .parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     BytesReference.bytes(
                         XContentFactory.jsonBuilder()
@@ -907,7 +890,6 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase {
         doc = mapperService.documentMapper()
             .parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     BytesReference.bytes(
                         XContentFactory.jsonBuilder()
@@ -1001,7 +983,6 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase {
         ParsedDocument doc = mapperService.documentMapper()
             .parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field(fieldName, qb).endObject()),
                     XContentType.JSON
@@ -1026,7 +1007,6 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase {
         doc = mapperService.documentMapper()
             .parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field(fieldName, qb).endObject()),
                     XContentType.JSON
@@ -1054,7 +1034,6 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase {
         doc = mapperService.documentMapper()
             .parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field(fieldName, qb).endObject()),
                     XContentType.JSON

+ 1 - 1
plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/ICUCollationKeywordFieldMapperTests.java

@@ -106,7 +106,7 @@ public class ICUCollationKeywordFieldMapperTests extends MapperTestCase {
 
         mapper = createDocumentMapper(fieldMapping(b -> b.field("type", FIELD_TYPE).field("null_value", "1234")));
         doc = mapper.parse(
-            new SourceToParse("test", "1", BytesReference.bytes(XContentFactory.jsonBuilder().startObject().endObject()), XContentType.JSON)
+            new SourceToParse("1", BytesReference.bytes(XContentFactory.jsonBuilder().startObject().endObject()), XContentType.JSON)
         );
 
         IndexableField[] fields = doc.rootDoc().getFields("field");

+ 2 - 2
server/src/internalClusterTest/java/org/elasticsearch/index/shard/IndexShardIT.java

@@ -358,7 +358,7 @@ public class IndexShardIT extends ESSingleNodeTestCase {
         shard.applyIndexOperationOnPrimary(
             Versions.MATCH_ANY,
             VersionType.INTERNAL,
-            new SourceToParse("test", "1", new BytesArray("{}"), XContentType.JSON),
+            new SourceToParse("1", new BytesArray("{}"), XContentType.JSON),
             SequenceNumbers.UNASSIGNED_SEQ_NO,
             0,
             IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,
@@ -443,7 +443,7 @@ public class IndexShardIT extends ESSingleNodeTestCase {
             final Engine.IndexResult result = shard.applyIndexOperationOnPrimary(
                 Versions.MATCH_ANY,
                 VersionType.INTERNAL,
-                new SourceToParse("test", "1", new BytesArray("{}"), XContentType.JSON),
+                new SourceToParse("1", new BytesArray("{}"), XContentType.JSON),
                 SequenceNumbers.UNASSIGNED_SEQ_NO,
                 0,
                 IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,

+ 0 - 4
server/src/main/java/org/elasticsearch/action/bulk/TransportShardBulkAction.java

@@ -50,7 +50,6 @@ import org.elasticsearch.index.mapper.MapperService;
 import org.elasticsearch.index.mapper.SourceToParse;
 import org.elasticsearch.index.seqno.SequenceNumbers;
 import org.elasticsearch.index.shard.IndexShard;
-import org.elasticsearch.index.shard.ShardId;
 import org.elasticsearch.index.translog.Translog;
 import org.elasticsearch.indices.ExecutorSelector;
 import org.elasticsearch.indices.IndicesService;
@@ -321,7 +320,6 @@ public class TransportShardBulkAction extends TransportWriteAction<BulkShardRequ
         } else {
             final IndexRequest request = context.getRequestToExecute();
             final SourceToParse sourceToParse = new SourceToParse(
-                request.index(),
                 request.id(),
                 request.source(),
                 request.getContentType(),
@@ -582,9 +580,7 @@ public class TransportShardBulkAction extends TransportWriteAction<BulkShardRequ
             case CREATE:
             case INDEX:
                 final IndexRequest indexRequest = (IndexRequest) docWriteRequest;
-                final ShardId shardId = replica.shardId();
                 final SourceToParse sourceToParse = new SourceToParse(
-                    shardId.getIndexName(),
                     indexRequest.id(),
                     indexRequest.source(),
                     indexRequest.getContentType(),

+ 1 - 1
server/src/main/java/org/elasticsearch/index/IndexService.java

@@ -681,7 +681,7 @@ public class IndexService extends AbstractIndexComponent implements IndicesClust
         return searchOperationListeners;
     }
 
-    public void updateMapping(final IndexMetadata currentIndexMetadata, final IndexMetadata newIndexMetadata) throws IOException {
+    public void updateMapping(final IndexMetadata currentIndexMetadata, final IndexMetadata newIndexMetadata) {
         if (mapperService != null) {
             mapperService.updateMapping(currentIndexMetadata, newIndexMetadata);
         }

+ 0 - 1
server/src/main/java/org/elasticsearch/index/engine/TranslogDirectoryReader.java

@@ -250,7 +250,6 @@ final class TranslogDirectoryReader extends DirectoryReader {
             assert Thread.holdsLock(this);
             final ParsedDocument parsedDocs = documentParser.parseDocument(
                 new SourceToParse(
-                    shardId.getIndexName(),
                     operation.id(),
                     operation.source(),
                     XContentHelper.xContentType(operation.source()),

+ 1 - 5
server/src/main/java/org/elasticsearch/index/mapper/CustomTermFreqField.java

@@ -28,17 +28,13 @@ public final class CustomTermFreqField extends Field {
         FIELD_TYPE.setIndexOptions(IndexOptions.DOCS_AND_FREQS);
     }
 
-    private int fieldValue;
+    private final int fieldValue;
 
     public CustomTermFreqField(String fieldName, CharSequence term, int fieldValue) {
         super(fieldName, term, FIELD_TYPE);
         this.fieldValue = fieldValue;
     }
 
-    public void setFieldValue(int fieldValue) {
-        this.fieldValue = fieldValue;
-    }
-
     @Override
     public TokenStream tokenStream(Analyzer analyzer, TokenStream reuse) {
         CustomTermFreqTokenStream stream;

+ 4 - 10
server/src/main/java/org/elasticsearch/index/mapper/DataStreamTimestampFieldMapper.java

@@ -34,14 +34,8 @@ public class DataStreamTimestampFieldMapper extends MetadataFieldMapper {
     public static final String NAME = "_data_stream_timestamp";
     public static final String DEFAULT_PATH = "@timestamp";
 
-    public static final DataStreamTimestampFieldMapper ENABLED_INSTANCE = new DataStreamTimestampFieldMapper(
-        TimestampFieldType.INSTANCE,
-        true
-    );
-    private static final DataStreamTimestampFieldMapper DISABLED_INSTANCE = new DataStreamTimestampFieldMapper(
-        TimestampFieldType.INSTANCE,
-        false
-    );
+    public static final DataStreamTimestampFieldMapper ENABLED_INSTANCE = new DataStreamTimestampFieldMapper(true);
+    private static final DataStreamTimestampFieldMapper DISABLED_INSTANCE = new DataStreamTimestampFieldMapper(false);
 
     // For now the field shouldn't be useable in searches.
     // In the future it should act as an alias to the actual data stream timestamp field.
@@ -103,8 +97,8 @@ public class DataStreamTimestampFieldMapper extends MetadataFieldMapper {
 
     private final boolean enabled;
 
-    private DataStreamTimestampFieldMapper(MappedFieldType mappedFieldType, boolean enabled) {
-        super(mappedFieldType);
+    private DataStreamTimestampFieldMapper(boolean enabled) {
+        super(TimestampFieldType.INSTANCE);
         this.enabled = enabled;
     }
 

+ 1 - 17
server/src/main/java/org/elasticsearch/index/mapper/DateFieldMapper.java

@@ -87,11 +87,6 @@ public final class DateFieldMapper extends FieldMapper {
                 return Instant.ofEpochMilli(value);
             }
 
-            @Override
-            public Instant clampToValidRange(Instant instant) {
-                return instant;
-            }
-
             @Override
             public long parsePointAsMillis(byte[] value) {
                 return LongPoint.decodeDimension(value, 0);
@@ -123,11 +118,6 @@ public final class DateFieldMapper extends FieldMapper {
                 return DateUtils.toInstant(value);
             }
 
-            @Override
-            public Instant clampToValidRange(Instant instant) {
-                return DateUtils.clampToNanosRange(instant);
-            }
-
             @Override
             public long parsePointAsMillis(byte[] value) {
                 return roundDownToMillis(LongPoint.decodeDimension(value, 0));
@@ -180,12 +170,6 @@ public final class DateFieldMapper extends FieldMapper {
          */
         public abstract Instant toInstant(long value);
 
-        /**
-         * Return the instant that this range can represent that is closest to
-         * the provided instant.
-         */
-        public abstract Instant clampToValidRange(Instant instant);
-
         /**
          * Decode the points representation of this field as milliseconds.
          */
@@ -620,7 +604,7 @@ public final class DateFieldMapper extends FieldMapper {
             ZoneId timeZone,
             DateMathParser dateParser,
             QueryRewriteContext context
-        ) throws IOException {
+        ) {
             if (dateParser == null) {
                 if (from instanceof Number || to instanceof Number) {
                     // force epoch_millis

+ 0 - 21
server/src/main/java/org/elasticsearch/index/mapper/DocumentParserContext.java

@@ -50,11 +50,6 @@ public abstract class DocumentParserContext {
             return in.isWithinCopyTo();
         }
 
-        @Override
-        public boolean isWithinMultiFields() {
-            return in.isWithinMultiFields();
-        }
-
         @Override
         public ContentPath path() {
             return in.path();
@@ -268,22 +263,6 @@ public abstract class DocumentParserContext {
         return false;
     }
 
-    /**
-     * Return a new context that will be within multi-fields.
-     */
-    public final DocumentParserContext createMultiFieldContext() {
-        return new Wrapper(this) {
-            @Override
-            public boolean isWithinMultiFields() {
-                return true;
-            }
-        };
-    }
-
-    public boolean isWithinMultiFields() {
-        return false;
-    }
-
     /**
      * Return a new context that will be used within a nested document.
      */

+ 2 - 50
server/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java

@@ -438,7 +438,7 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
         builder.field("type", contentType());
         getMergeBuilder().toXContent(builder, params);
         multiFields.toXContent(builder, params);
-        copyTo.toXContent(builder, params);
+        copyTo.toXContent(builder);
     }
 
     protected abstract String contentType();
@@ -512,8 +512,6 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
                 return;
             }
 
-            context = context.createMultiFieldContext();
-
             context.path().add(mainField.simpleName());
             for (FieldMapper mapper : mappers.values()) {
                 mapper.parse(context);
@@ -521,20 +519,6 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
             context.path().remove();
         }
 
-        public MultiFields merge(MultiFields mergeWith) {
-            Map<String, FieldMapper> newMappers = new HashMap<>();
-            for (FieldMapper mapper : mergeWith.mappers.values()) {
-                FieldMapper mergeIntoMapper = mappers.get(mapper.simpleName());
-                if (mergeIntoMapper == null) {
-                    newMappers.put(mapper.simpleName(), mapper);
-                } else {
-                    FieldMapper merged = mergeIntoMapper.merge(mapper);
-                    newMappers.put(merged.simpleName(), merged); // override previous definition
-                }
-            }
-            return new MultiFields(Collections.unmodifiableMap(newMappers));
-        }
-
         @Override
         public Iterator<FieldMapper> iterator() {
             return mappers.values().iterator();
@@ -573,7 +557,7 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
             this.copyToFields = copyToFields;
         }
 
-        public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
+        public XContentBuilder toXContent(XContentBuilder builder) throws IOException {
             if (copyToFields.isEmpty() == false) {
                 builder.startArray("copy_to");
                 for (String field : copyToFields) {
@@ -900,38 +884,6 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
             ).setSerializer((b, n, v) -> b.field(n, v.value()), v -> Boolean.toString(v.value()));
         }
 
-        /**
-         * Defines a parameter that takes a double value
-         * @param name          the parameter name
-         * @param updateable    whether the parameter can be changed by a mapping update
-         * @param initializer   a function that reads the parameter value from an existing mapper
-         * @param defaultValue  the default value, to be used if the parameter is undefined in a mapping
-         */
-        public static Parameter<Double> doubleParam(
-            String name,
-            boolean updateable,
-            Function<FieldMapper, Double> initializer,
-            double defaultValue
-        ) {
-            return new Parameter<>(name, updateable, () -> defaultValue, (n, c, o) -> XContentMapValues.nodeDoubleValue(o), initializer);
-        }
-
-        /**
-         * Defines a parameter that takes a float value
-         * @param name          the parameter name
-         * @param updateable    whether the parameter can be changed by a mapping update
-         * @param initializer   a function that reads the parameter value from an existing mapper
-         * @param defaultValue  the default value, to be used if the parameter is undefined in a mapping
-         */
-        public static Parameter<Float> floatParam(
-            String name,
-            boolean updateable,
-            Function<FieldMapper, Float> initializer,
-            float defaultValue
-        ) {
-            return new Parameter<>(name, updateable, () -> defaultValue, (n, c, o) -> XContentMapValues.nodeFloatValue(o), initializer);
-        }
-
         /**
          * Defines a parameter that takes an integer value
          * @param name          the parameter name

+ 0 - 1
server/src/main/java/org/elasticsearch/index/mapper/IdFieldMapper.java

@@ -66,7 +66,6 @@ public class IdFieldMapper extends MetadataFieldMapper {
     public static final String CONTENT_TYPE = "_id";
 
     public static class Defaults {
-        public static final String NAME = IdFieldMapper.NAME;
 
         public static final FieldType FIELD_TYPE = new FieldType();
         public static final FieldType NESTED_FIELD_TYPE;

+ 1 - 2
server/src/main/java/org/elasticsearch/index/mapper/IndexFieldMapper.java

@@ -18,7 +18,6 @@ import org.elasticsearch.search.aggregations.support.CoreValuesSourceType;
 import org.elasticsearch.search.lookup.SearchLookup;
 import org.elasticsearch.search.lookup.SourceLookup;
 
-import java.io.IOException;
 import java.util.Collections;
 import java.util.List;
 import java.util.function.Supplier;
@@ -73,7 +72,7 @@ public class IndexFieldMapper extends MetadataFieldMapper {
                 private final List<Object> indexName = List.of(context.getFullyQualifiedIndex().getName());
 
                 @Override
-                public List<Object> fetchValues(SourceLookup lookup, List<Object> ignoredValues) throws IOException {
+                public List<Object> fetchValues(SourceLookup lookup, List<Object> ignoredValues) {
                     return indexName;
                 }
             };

+ 1 - 1
server/src/main/java/org/elasticsearch/index/mapper/KeywordFieldMapper.java

@@ -365,7 +365,7 @@ public final class KeywordFieldMapper extends FieldMapper {
         // would work but either leaves us positioned on the seek term (if it exists) or the
         // term after (if the seek term doesn't exist). That complicates any subsequent
         // iteration logic so this class simplifies the pagination use case.
-        final class SearchAfterTermsEnum extends FilteredTermsEnum {
+        static final class SearchAfterTermsEnum extends FilteredTermsEnum {
             private final BytesRef afterRef;
 
             SearchAfterTermsEnum(TermsEnum tenum, BytesRef termText) {

+ 1 - 5
server/src/main/java/org/elasticsearch/index/mapper/MapperService.java

@@ -185,10 +185,6 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
         return this.indexAnalyzers;
     }
 
-    public NamedAnalyzer getNamedAnalyzer(String analyzerName) {
-        return this.indexAnalyzers.get(analyzerName);
-    }
-
     public MappingParserContext parserContext() {
         return parserContextSupplier.get();
     }
@@ -252,7 +248,7 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
     /**
      * Update local mapping by applying the incoming mapping that have already been merged with the current one on the master
      */
-    public void updateMapping(final IndexMetadata currentIndexMetadata, final IndexMetadata newIndexMetadata) throws IOException {
+    public void updateMapping(final IndexMetadata currentIndexMetadata, final IndexMetadata newIndexMetadata) {
         assert newIndexMetadata.getIndex().equals(index())
             : "index mismatch: expected " + index() + " but was " + newIndexMetadata.getIndex();
 

+ 0 - 4
server/src/main/java/org/elasticsearch/index/mapper/MappingParserContext.java

@@ -117,10 +117,6 @@ public class MappingParserContext {
         return false;
     }
 
-    protected Function<String, SimilarityProvider> similarityLookupService() {
-        return similarityLookupService;
-    }
-
     /**
      * The {@linkplain ScriptCompiler} to compile scripts needed by the {@linkplain Mapper}.
      */

+ 0 - 13
server/src/main/java/org/elasticsearch/index/mapper/RangeType.java

@@ -399,7 +399,6 @@ public enum RangeType {
         @Override
         public Query withinQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
             return createQuery(
-                field,
                 (Float) from,
                 (Float) to,
                 includeFrom,
@@ -412,7 +411,6 @@ public enum RangeType {
         @Override
         public Query containsQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
             return createQuery(
-                field,
                 (Float) from,
                 (Float) to,
                 includeFrom,
@@ -425,7 +423,6 @@ public enum RangeType {
         @Override
         public Query intersectsQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
             return createQuery(
-                field,
                 (Float) from,
                 (Float) to,
                 includeFrom,
@@ -510,7 +507,6 @@ public enum RangeType {
         @Override
         public Query withinQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
             return createQuery(
-                field,
                 (Double) from,
                 (Double) to,
                 includeFrom,
@@ -523,7 +519,6 @@ public enum RangeType {
         @Override
         public Query containsQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
             return createQuery(
-                field,
                 (Double) from,
                 (Double) to,
                 includeFrom,
@@ -536,7 +531,6 @@ public enum RangeType {
         @Override
         public Query intersectsQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
             return createQuery(
-                field,
                 (Double) from,
                 (Double) to,
                 includeFrom,
@@ -605,7 +599,6 @@ public enum RangeType {
         @Override
         public Query withinQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
             return createQuery(
-                field,
                 (Integer) from,
                 (Integer) to,
                 includeFrom,
@@ -618,7 +611,6 @@ public enum RangeType {
         @Override
         public Query containsQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
             return createQuery(
-                field,
                 (Integer) from,
                 (Integer) to,
                 includeFrom,
@@ -631,7 +623,6 @@ public enum RangeType {
         @Override
         public Query intersectsQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
             return createQuery(
-                field,
                 (Integer) from,
                 (Integer) to,
                 includeFrom,
@@ -716,7 +707,6 @@ public enum RangeType {
         @Override
         public Query withinQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
             return createQuery(
-                field,
                 (Long) from,
                 (Long) to,
                 includeFrom,
@@ -729,7 +719,6 @@ public enum RangeType {
         @Override
         public Query containsQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
             return createQuery(
-                field,
                 (Long) from,
                 (Long) to,
                 includeFrom,
@@ -742,7 +731,6 @@ public enum RangeType {
         @Override
         public Query intersectsQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
             return createQuery(
-                field,
                 (Long) from,
                 (Long) to,
                 includeFrom,
@@ -782,7 +770,6 @@ public enum RangeType {
      * This helper handles all {@link Number} cases and dates, the IP range type uses its own logic.
      */
     private static <T extends Comparable<T>> Query createQuery(
-        String field,
         T from,
         T to,
         boolean includeFrom,

+ 2 - 15
server/src/main/java/org/elasticsearch/index/mapper/SourceToParse.java

@@ -20,8 +20,6 @@ public class SourceToParse {
 
     private final BytesReference source;
 
-    private final String index;
-
     private final String id;
 
     private final @Nullable String routing;
@@ -31,14 +29,12 @@ public class SourceToParse {
     private final Map<String, String> dynamicTemplates;
 
     public SourceToParse(
-        String index,
         String id,
         BytesReference source,
         XContentType xContentType,
         @Nullable String routing,
         Map<String, String> dynamicTemplates
     ) {
-        this.index = Objects.requireNonNull(index);
         this.id = Objects.requireNonNull(id);
         // we always convert back to byte array, since we store it and Field only supports bytes..
         // so, we might as well do it here, and improve the performance of working with direct byte arrays
@@ -48,18 +44,14 @@ public class SourceToParse {
         this.dynamicTemplates = Objects.requireNonNull(dynamicTemplates);
     }
 
-    public SourceToParse(String index, String id, BytesReference source, XContentType xContentType) {
-        this(index, id, source, xContentType, null, Map.of());
+    public SourceToParse(String id, BytesReference source, XContentType xContentType) {
+        this(id, source, xContentType, null, Map.of());
     }
 
     public BytesReference source() {
         return this.source;
     }
 
-    public String index() {
-        return this.index;
-    }
-
     public String id() {
         return this.id;
     }
@@ -78,9 +70,4 @@ public class SourceToParse {
     public XContentType getXContentType() {
         return this.xContentType;
     }
-
-    public enum Origin {
-        PRIMARY,
-        REPLICA
-    }
 }

+ 1 - 1
server/src/main/java/org/elasticsearch/index/mapper/TextFieldMapper.java

@@ -1103,7 +1103,7 @@ public class TextFieldMapper extends FieldMapper {
         b.index.toXContent(builder, includeDefaults);
         b.store.toXContent(builder, includeDefaults);
         this.multiFields.toXContent(builder, params);
-        this.copyTo.toXContent(builder, params);
+        this.copyTo.toXContent(builder);
         b.meta.toXContent(builder, includeDefaults);
         b.indexOptions.toXContent(builder, includeDefaults);
         b.termVectors.toXContent(builder, includeDefaults);

+ 0 - 16
server/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java

@@ -27,22 +27,6 @@ import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeSt
 public class TypeParsers {
     private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(TypeParsers.class);
 
-    public static final String DOC_VALUES = "doc_values";
-    public static final String INDEX_OPTIONS_DOCS = "docs";
-    public static final String INDEX_OPTIONS_FREQS = "freqs";
-    public static final String INDEX_OPTIONS_POSITIONS = "positions";
-    public static final String INDEX_OPTIONS_OFFSETS = "offsets";
-
-    public static void checkNull(String propName, Object propNode) {
-        if (false == propName.equals("null_value") && propNode == null) {
-            /*
-             * No properties *except* null_value are allowed to have null. So we catch it here and tell the user something useful rather
-             * than send them a null pointer exception later.
-             */
-            throw new MapperParsingException("[" + propName + "] must not have a [null] value");
-        }
-    }
-
     /**
      * Parse the {@code meta} key of the mapping.
      */

+ 0 - 1
server/src/main/java/org/elasticsearch/index/mapper/Uid.java

@@ -17,7 +17,6 @@ import java.util.Base64;
 
 public final class Uid {
 
-    public static final char DELIMITER = '#';
     public static final byte DELIMITER_BYTE = 0x23;
 
     private static final int UTF8 = 0xff;

+ 4 - 6
server/src/main/java/org/elasticsearch/index/mapper/flattened/FlattenedFieldMapper.java

@@ -359,7 +359,7 @@ public final class FlattenedFieldMapper extends FieldMapper {
         @Override
         public IndexFieldData.Builder fielddataBuilder(String fullyQualifiedIndexName, Supplier<SearchLookup> searchLookup) {
             failIfNoDocValues();
-            return new KeyedFlattenedFieldData.Builder(name(), key, CoreValuesSourceType.KEYWORD);
+            return new KeyedFlattenedFieldData.Builder(name(), key);
         }
 
         @Override
@@ -369,7 +369,7 @@ public final class FlattenedFieldMapper extends FieldMapper {
                     "Field [" + rootName + "." + key + "] of type [" + typeName() + "] doesn't support formats."
                 );
             }
-            return SourceValueFetcher.identity(rootName + "." + key, context, format);
+            return SourceValueFetcher.identity(rootName + "." + key, context, null);
         }
     }
 
@@ -556,12 +556,10 @@ public final class FlattenedFieldMapper extends FieldMapper {
         public static class Builder implements IndexFieldData.Builder {
             private final String fieldName;
             private final String key;
-            private final ValuesSourceType valuesSourceType;
 
-            Builder(String fieldName, String key, ValuesSourceType valuesSourceType) {
+            Builder(String fieldName, String key) {
                 this.fieldName = fieldName;
                 this.key = key;
-                this.valuesSourceType = valuesSourceType;
             }
 
             @Override
@@ -569,7 +567,7 @@ public final class FlattenedFieldMapper extends FieldMapper {
                 IndexOrdinalsFieldData delegate = new SortedSetOrdinalsIndexFieldData(
                     cache,
                     fieldName,
-                    valuesSourceType,
+                    CoreValuesSourceType.KEYWORD,
                     breakerService,
                     AbstractLeafOrdinalsFieldData.DEFAULT_SCRIPT_FUNCTION
                 );

+ 1 - 8
server/src/main/java/org/elasticsearch/index/shard/IndexShard.java

@@ -1799,14 +1799,7 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
                     index.getAutoGeneratedIdTimestamp(),
                     true,
                     origin,
-                    new SourceToParse(
-                        shardId.getIndexName(),
-                        index.id(),
-                        index.source(),
-                        XContentHelper.xContentType(index.source()),
-                        index.routing(),
-                        Map.of()
-                    )
+                    new SourceToParse(index.id(), index.source(), XContentHelper.xContentType(index.source()), index.routing(), Map.of())
                 );
                 break;
             case DELETE:

+ 1 - 8
server/src/main/java/org/elasticsearch/index/termvectors/TermVectorsService.java

@@ -304,14 +304,7 @@ public class TermVectorsService {
     }
 
     private static Fields generateTermVectorsFromDoc(IndexShard indexShard, TermVectorsRequest request) throws IOException {
-        SourceToParse source = new SourceToParse(
-            indexShard.shardId().getIndexName(),
-            "_id_for_tv_api",
-            request.doc(),
-            request.xContentType(),
-            request.routing(),
-            Map.of()
-        );
+        SourceToParse source = new SourceToParse("_id_for_tv_api", request.doc(), request.xContentType(), request.routing(), Map.of());
         DocumentParser documentParser = indexShard.mapperService().documentParser();
         MappingLookup mappingLookup = indexShard.mapperService().mappingLookup();
         ParsedDocument parsedDocument = documentParser.parseDocument(source, mappingLookup);

+ 4 - 4
server/src/test/java/org/elasticsearch/index/fielddata/BinaryDVFieldDataTests.java

@@ -60,16 +60,16 @@ public class BinaryDVFieldDataTests extends AbstractFieldDataTestCase {
             doc.endArray();
         }
         doc.endObject();
-        ParsedDocument d = mapper.parse(new SourceToParse("test", "1", BytesReference.bytes(doc), XContentType.JSON));
+        ParsedDocument d = mapper.parse(new SourceToParse("1", BytesReference.bytes(doc), XContentType.JSON));
         writer.addDocument(d.rootDoc());
 
         BytesRef bytes1 = randomBytes();
         doc = XContentFactory.jsonBuilder().startObject().field("field", bytes1.bytes, bytes1.offset, bytes1.length).endObject();
-        d = mapper.parse(new SourceToParse("test", "2", BytesReference.bytes(doc), XContentType.JSON));
+        d = mapper.parse(new SourceToParse("2", BytesReference.bytes(doc), XContentType.JSON));
         writer.addDocument(d.rootDoc());
 
         doc = XContentFactory.jsonBuilder().startObject().endObject();
-        d = mapper.parse(new SourceToParse("test", "3", BytesReference.bytes(doc), XContentType.JSON));
+        d = mapper.parse(new SourceToParse("3", BytesReference.bytes(doc), XContentType.JSON));
         writer.addDocument(d.rootDoc());
 
         // test remove duplicate value
@@ -85,7 +85,7 @@ public class BinaryDVFieldDataTests extends AbstractFieldDataTestCase {
             doc.endArray();
         }
         doc.endObject();
-        d = mapper.parse(new SourceToParse("test", "4", BytesReference.bytes(doc), XContentType.JSON));
+        d = mapper.parse(new SourceToParse("4", BytesReference.bytes(doc), XContentType.JSON));
         writer.addDocument(d.rootDoc());
 
         IndexFieldData<?> indexFieldData = getForField("field");

+ 1 - 1
server/src/test/java/org/elasticsearch/index/mapper/BooleanScriptFieldTypeTests.java

@@ -326,7 +326,7 @@ public class BooleanScriptFieldTypeTests extends AbstractNonTextScriptFieldTypeT
             List<Boolean> values = randomList(0, 2, ESTestCase::randomBoolean);
             String source = "{\"foo\": " + values + "}";
             XContentParser parser = createParser(JsonXContent.jsonXContent, source);
-            SourceToParse sourceToParse = new SourceToParse("test", "test", new BytesArray(source), XContentType.JSON);
+            SourceToParse sourceToParse = new SourceToParse("test", new BytesArray(source), XContentType.JSON);
             DocumentParserContext ctx = new TestDocumentParserContext(MappingLookup.EMPTY, null, null, null, sourceToParse) {
                 @Override
                 public XContentParser parser() {

+ 5 - 5
server/src/test/java/org/elasticsearch/index/mapper/CopyToMapperTests.java

@@ -653,7 +653,7 @@ public class CopyToMapperTests extends MapperServiceTestCase {
 
         MapperParsingException ex = expectThrows(
             MapperParsingException.class,
-            () -> docMapper.parse(new SourceToParse("test", "1", json, XContentType.JSON)).rootDoc()
+            () -> docMapper.parse(new SourceToParse("1", json, XContentType.JSON)).rootDoc()
         );
         assertEquals(
             "Cannot copy field [date] to fields [date_copy]. Copy-to currently only works for value-type fields, not objects.",
@@ -679,7 +679,7 @@ public class CopyToMapperTests extends MapperServiceTestCase {
 
         BytesReference json = BytesReference.bytes(jsonBuilder().startObject().nullField("keyword").endObject());
 
-        LuceneDocument document = docMapper.parse(new SourceToParse("test", "1", json, XContentType.JSON)).rootDoc();
+        LuceneDocument document = docMapper.parse(new SourceToParse("1", json, XContentType.JSON)).rootDoc();
         assertEquals(0, document.getFields("keyword").length);
 
         IndexableField[] fields = document.getFields("keyword_copy");
@@ -705,7 +705,7 @@ public class CopyToMapperTests extends MapperServiceTestCase {
             for (String value : List.of("41.12,-71.34", "drm3btev3e86", "POINT (-71.34 41.12)")) {
                 BytesReference json = BytesReference.bytes(jsonBuilder().startObject().field("geopoint", value).endObject());
 
-                LuceneDocument doc = docMapper.parse(new SourceToParse("test", "1", json, XContentType.JSON)).rootDoc();
+                LuceneDocument doc = docMapper.parse(new SourceToParse("1", json, XContentType.JSON)).rootDoc();
 
                 IndexableField[] fields = doc.getFields("geopoint");
                 assertThat(fields.length, equalTo(2));
@@ -722,7 +722,7 @@ public class CopyToMapperTests extends MapperServiceTestCase {
 
             MapperParsingException ex = expectThrows(
                 MapperParsingException.class,
-                () -> docMapper.parse(new SourceToParse("test", "1", json, XContentType.JSON)).rootDoc()
+                () -> docMapper.parse(new SourceToParse("1", json, XContentType.JSON)).rootDoc()
             );
             assertEquals(
                 "Cannot copy field [geopoint] to fields [geopoint_copy]. Copy-to currently only works for value-type fields, not objects.",
@@ -736,7 +736,7 @@ public class CopyToMapperTests extends MapperServiceTestCase {
 
             MapperParsingException ex = expectThrows(
                 MapperParsingException.class,
-                () -> docMapper.parse(new SourceToParse("test", "1", json, XContentType.JSON)).rootDoc()
+                () -> docMapper.parse(new SourceToParse("1", json, XContentType.JSON)).rootDoc()
             );
             assertEquals(
                 "Cannot copy field [geopoint] to fields [geopoint_copy]. Copy-to currently only works for value-type fields, not objects.",

+ 4 - 4
server/src/test/java/org/elasticsearch/index/mapper/DocumentParserTests.java

@@ -1527,7 +1527,7 @@ public class DocumentParserTests extends MapperServiceTestCase {
         // reparse it
         DocumentMapper builtDocMapper = createDocumentMapper(builtMapping);
         BytesReference json = new BytesArray(copyToBytesFromClasspath("/org/elasticsearch/index/mapper/simple/test1.json"));
-        LuceneDocument doc = builtDocMapper.parse(new SourceToParse("test", "1", json, XContentType.JSON)).rootDoc();
+        LuceneDocument doc = builtDocMapper.parse(new SourceToParse("1", json, XContentType.JSON)).rootDoc();
         assertThat(doc.getBinaryValue(builtDocMapper.idFieldMapper().name()), equalTo(Uid.encodeId("1")));
         assertThat(doc.get(builtDocMapper.mappers().getMapper("name.first").name()), equalTo("shay"));
     }
@@ -1539,7 +1539,7 @@ public class DocumentParserTests extends MapperServiceTestCase {
         assertThat((String) docMapper.mapping().getMeta().get("param1"), equalTo("value1"));
 
         BytesReference json = new BytesArray(copyToBytesFromClasspath("/org/elasticsearch/index/mapper/simple/test1.json"));
-        LuceneDocument doc = docMapper.parse(new SourceToParse("test", "1", json, XContentType.JSON)).rootDoc();
+        LuceneDocument doc = docMapper.parse(new SourceToParse("1", json, XContentType.JSON)).rootDoc();
         assertThat(doc.getBinaryValue(docMapper.idFieldMapper().name()), equalTo(Uid.encodeId("1")));
         assertThat(doc.get(docMapper.mappers().getMapper("name.first").name()), equalTo("shay"));
     }
@@ -1548,7 +1548,7 @@ public class DocumentParserTests extends MapperServiceTestCase {
         String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/simple/test-mapping.json");
         DocumentMapper docMapper = createDocumentMapper(mapping);
         BytesReference json = new BytesArray(copyToBytesFromClasspath("/org/elasticsearch/index/mapper/simple/test1-notype-noid.json"));
-        LuceneDocument doc = docMapper.parse(new SourceToParse("test", "1", json, XContentType.JSON)).rootDoc();
+        LuceneDocument doc = docMapper.parse(new SourceToParse("1", json, XContentType.JSON)).rootDoc();
         assertThat(doc.getBinaryValue(docMapper.idFieldMapper().name()), equalTo(Uid.encodeId("1")));
         assertThat(doc.get(docMapper.mappers().getMapper("name.first").name()), equalTo("shay"));
     }
@@ -1570,7 +1570,7 @@ public class DocumentParserTests extends MapperServiceTestCase {
         BytesReference json = new BytesArray("".getBytes(StandardCharsets.UTF_8));
         MapperParsingException e = expectThrows(
             MapperParsingException.class,
-            () -> docMapper.parse(new SourceToParse("test", "1", json, XContentType.JSON))
+            () -> docMapper.parse(new SourceToParse("1", json, XContentType.JSON))
         );
         assertThat(e.getMessage(), equalTo("failed to parse, document is empty"));
     }

+ 1 - 1
server/src/test/java/org/elasticsearch/index/mapper/DynamicMappingTests.java

@@ -461,7 +461,7 @@ public class DynamicMappingTests extends MapperServiceTestCase {
                 .field("quux", "3.2") // float detected through numeric detection
                 .endObject()
         );
-        ParsedDocument parsedDocument = mapper.parse(new SourceToParse("index", "id", source, builder.contentType()));
+        ParsedDocument parsedDocument = mapper.parse(new SourceToParse("id", source, builder.contentType()));
         Mapping update = parsedDocument.dynamicMappingsUpdate();
         assertNotNull(update);
         assertThat(((FieldMapper) update.getRoot().getMapper("foo")).fieldType().typeName(), equalTo("float"));

+ 0 - 1
server/src/test/java/org/elasticsearch/index/mapper/DynamicTemplatesTests.java

@@ -688,7 +688,6 @@ public class DynamicTemplatesTests extends MapperServiceTestCase {
         ParsedDocument doc = mapperService.documentMapper()
             .parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     new BytesArray("{\"foo\": \"41.12,-71.34\", \"bar\": \"41.12,-71.34\"}"),
                     XContentType.JSON,

+ 0 - 1
server/src/test/java/org/elasticsearch/index/mapper/FieldNamesFieldMapperTests.java

@@ -49,7 +49,6 @@ public class FieldNamesFieldMapperTests extends MapperServiceTestCase {
 
         ParsedDocument doc = defaultMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     XContentFactory.jsonBuilder().startObject().field("a", "100").startObject("b").field("c", 42).endObject().endObject()

+ 2 - 2
server/src/test/java/org/elasticsearch/index/mapper/JavaMultiFieldMergeTests.java

@@ -28,7 +28,7 @@ public class JavaMultiFieldMergeTests extends MapperServiceTestCase {
         assertThat(mapperService.fieldType("name.indexed"), nullValue());
 
         BytesReference json = BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field("name", "some name").endObject());
-        LuceneDocument doc = mapperService.documentMapper().parse(new SourceToParse("test", "1", json, XContentType.JSON)).rootDoc();
+        LuceneDocument doc = mapperService.documentMapper().parse(new SourceToParse("1", json, XContentType.JSON)).rootDoc();
         IndexableField f = doc.getField("name");
         assertThat(f, notNullValue());
         f = doc.getField("name.indexed");
@@ -44,7 +44,7 @@ public class JavaMultiFieldMergeTests extends MapperServiceTestCase {
         assertThat(mapperService.fieldType("name.not_indexed2"), nullValue());
         assertThat(mapperService.fieldType("name.not_indexed3"), nullValue());
 
-        doc = mapperService.documentMapper().parse(new SourceToParse("test", "1", json, XContentType.JSON)).rootDoc();
+        doc = mapperService.documentMapper().parse(new SourceToParse("1", json, XContentType.JSON)).rootDoc();
         f = doc.getField("name");
         assertThat(f, notNullValue());
         f = doc.getField("name.indexed");

+ 2 - 2
server/src/test/java/org/elasticsearch/index/mapper/MultiFieldTests.java

@@ -37,7 +37,7 @@ public class MultiFieldTests extends MapperServiceTestCase {
         MapperService mapperService = createMapperService(mapping);
 
         BytesReference json = new BytesArray(copyToBytesFromClasspath("/org/elasticsearch/index/mapper/multifield/test-data.json"));
-        LuceneDocument doc = mapperService.documentMapper().parse(new SourceToParse("test", "1", json, XContentType.JSON)).rootDoc();
+        LuceneDocument doc = mapperService.documentMapper().parse(new SourceToParse("1", json, XContentType.JSON)).rootDoc();
 
         IndexableField f = doc.getField("name");
         assertThat(f.name(), equalTo("name"));
@@ -113,7 +113,7 @@ public class MultiFieldTests extends MapperServiceTestCase {
         }));
 
         BytesReference json = new BytesArray(copyToBytesFromClasspath("/org/elasticsearch/index/mapper/multifield/test-data.json"));
-        LuceneDocument doc = builderDocMapper.parse(new SourceToParse("test", "1", json, XContentType.JSON)).rootDoc();
+        LuceneDocument doc = builderDocMapper.parse(new SourceToParse("1", json, XContentType.JSON)).rootDoc();
 
         IndexableField f = doc.getField("name");
         assertThat(f.name(), equalTo("name"));

+ 8 - 20
server/src/test/java/org/elasticsearch/index/mapper/NestedObjectMapperTests.java

@@ -44,7 +44,6 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
 
         doc = docMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     XContentFactory.jsonBuilder().startObject().field("field", "value").startArray("nested").endArray().endObject()
@@ -67,7 +66,6 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
 
         ParsedDocument doc = docMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     XContentFactory.jsonBuilder()
@@ -92,7 +90,6 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
 
         doc = docMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     XContentFactory.jsonBuilder()
@@ -153,7 +150,6 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
 
         ParsedDocument doc = docMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     XContentFactory.jsonBuilder()
@@ -244,7 +240,6 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
 
         ParsedDocument doc = docMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     XContentFactory.jsonBuilder()
@@ -336,7 +331,6 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
 
         ParsedDocument doc = docMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     XContentFactory.jsonBuilder()
@@ -431,7 +425,6 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
 
         ParsedDocument doc = docMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     XContentFactory.jsonBuilder()
@@ -525,7 +518,6 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
 
         ParsedDocument doc = docMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     XContentFactory.jsonBuilder()
@@ -632,7 +624,6 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
 
         ParsedDocument doc = docMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     XContentFactory.jsonBuilder()
@@ -716,7 +707,6 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
 
         ParsedDocument doc = docMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     XContentFactory.jsonBuilder()
@@ -762,7 +752,6 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
 
         ParsedDocument doc = docMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     XContentFactory.jsonBuilder()
@@ -857,7 +846,7 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
             docBuilder.endArray();
         }
         docBuilder.endObject();
-        SourceToParse source1 = new SourceToParse("test1", "1", BytesReference.bytes(docBuilder), XContentType.JSON);
+        SourceToParse source1 = new SourceToParse("1", BytesReference.bytes(docBuilder), XContentType.JSON);
         MapperParsingException e = expectThrows(MapperParsingException.class, () -> docMapper.parse(source1));
         assertEquals(
             "The number of nested documents has exceeded the allowed limit of ["
@@ -888,7 +877,7 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
             docBuilder.endArray();
         }
         docBuilder.endObject();
-        SourceToParse source1 = new SourceToParse("test1", "1", BytesReference.bytes(docBuilder), XContentType.JSON);
+        SourceToParse source1 = new SourceToParse("1", BytesReference.bytes(docBuilder), XContentType.JSON);
         ParsedDocument doc = docMapper.parse(source1);
         assertThat(doc.docs().size(), equalTo(3));
 
@@ -905,7 +894,7 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
             docBuilder2.endArray();
         }
         docBuilder2.endObject();
-        SourceToParse source2 = new SourceToParse("test1", "2", BytesReference.bytes(docBuilder2), XContentType.JSON);
+        SourceToParse source2 = new SourceToParse("2", BytesReference.bytes(docBuilder2), XContentType.JSON);
         MapperParsingException e = expectThrows(MapperParsingException.class, () -> docMapper.parse(source2));
         assertEquals(
             "The number of nested documents has exceeded the allowed limit of ["
@@ -942,7 +931,7 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
             docBuilder.endArray();
         }
         docBuilder.endObject();
-        SourceToParse source1 = new SourceToParse("test1", "1", BytesReference.bytes(docBuilder), XContentType.JSON);
+        SourceToParse source1 = new SourceToParse("1", BytesReference.bytes(docBuilder), XContentType.JSON);
         ParsedDocument doc = docMapper.parse(source1);
         assertThat(doc.docs().size(), equalTo(3));
 
@@ -964,7 +953,7 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
 
         }
         docBuilder2.endObject();
-        SourceToParse source2 = new SourceToParse("test1", "2", BytesReference.bytes(docBuilder2), XContentType.JSON);
+        SourceToParse source2 = new SourceToParse("2", BytesReference.bytes(docBuilder2), XContentType.JSON);
         MapperParsingException e = expectThrows(MapperParsingException.class, () -> docMapper.parse(source2));
         assertEquals(
             "The number of nested documents has exceeded the allowed limit of ["
@@ -991,7 +980,6 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
 
         ParsedDocument doc = docMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     XContentFactory.jsonBuilder()
@@ -1214,7 +1202,7 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
             nested1.endObject();
         });
         b.endObject();
-        ParsedDocument doc = docMapper.parse(new SourceToParse("test", "1", BytesReference.bytes(b), XContentType.JSON));
+        ParsedDocument doc = docMapper.parse(new SourceToParse("1", BytesReference.bytes(b), XContentType.JSON));
 
         // Note doc values are disabled for field "integer2",
         // so the document only contains an IntPoint field whose stringValue method always returns null.
@@ -1292,7 +1280,7 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
             nested1.endObject();
         });
         b.endObject();
-        ParsedDocument doc = docMapper.parse(new SourceToParse("test", "1", BytesReference.bytes(b), XContentType.JSON));
+        ParsedDocument doc = docMapper.parse(new SourceToParse("1", BytesReference.bytes(b), XContentType.JSON));
 
         // Note doc values are disabled for field "integer2",
         // so the document only contains an IntPoint field whose stringValue method always returns null.
@@ -1371,7 +1359,7 @@ public class NestedObjectMapperTests extends MapperServiceTestCase {
             nested1.endObject();
         });
         b.endObject();
-        ParsedDocument doc = docMapper.parse(new SourceToParse("test", "1", BytesReference.bytes(b), XContentType.JSON));
+        ParsedDocument doc = docMapper.parse(new SourceToParse("1", BytesReference.bytes(b), XContentType.JSON));
 
         // Note doc values are disabled for field "integer2",
         // so the document only contains an IntPoint field whose stringValue method always returns null.

+ 1 - 1
server/src/test/java/org/elasticsearch/index/mapper/NestedPathFieldMapperTests.java

@@ -20,7 +20,7 @@ public class NestedPathFieldMapperTests extends MapperServiceTestCase {
 
     public void testDefaults() throws IOException {
         DocumentMapper mapper = createDocumentMapper(mapping(b -> {}));
-        ParsedDocument document = mapper.parse(new SourceToParse("index", "id", new BytesArray("{}"), XContentType.JSON));
+        ParsedDocument document = mapper.parse(new SourceToParse("id", new BytesArray("{}"), XContentType.JSON));
         assertEquals(Collections.<IndexableField>emptyList(), Arrays.asList(document.rootDoc().getFields(NestedPathFieldMapper.NAME)));
     }
 }

+ 0 - 3
server/src/test/java/org/elasticsearch/index/mapper/NullValueObjectMappingTests.java

@@ -27,7 +27,6 @@ public class NullValueObjectMappingTests extends MapperServiceTestCase {
 
         ParsedDocument doc = defaultMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     XContentFactory.jsonBuilder().startObject().startObject("obj1").endObject().field("value1", "test1").endObject()
@@ -40,7 +39,6 @@ public class NullValueObjectMappingTests extends MapperServiceTestCase {
 
         doc = defaultMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(XContentFactory.jsonBuilder().startObject().nullField("obj1").field("value1", "test1").endObject()),
                 XContentType.JSON
@@ -51,7 +49,6 @@ public class NullValueObjectMappingTests extends MapperServiceTestCase {
 
         doc = defaultMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     XContentFactory.jsonBuilder()

+ 0 - 1
server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperTests.java

@@ -29,7 +29,6 @@ public class ObjectMapperTests extends MapperServiceTestCase {
             IllegalArgumentException.class,
             () -> defaultMapper.parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     new BytesArray(
                         " {\n"

+ 1 - 2
server/src/test/java/org/elasticsearch/index/mapper/PathMatchDynamicTemplateTests.java

@@ -22,8 +22,7 @@ public class PathMatchDynamicTemplateTests extends MapperServiceTestCase {
         MapperService mapperService = createMapperService(mapping);
 
         byte[] json = copyToBytesFromClasspath("/org/elasticsearch/index/mapper/dynamictemplate/pathmatch/test-data.json");
-        ParsedDocument parsedDoc = mapperService.documentMapper()
-            .parse(new SourceToParse("test", "1", new BytesArray(json), XContentType.JSON));
+        ParsedDocument parsedDoc = mapperService.documentMapper().parse(new SourceToParse("1", new BytesArray(json), XContentType.JSON));
 
         merge(mapperService, dynamicMapping(parsedDoc.dynamicMappingsUpdate()));
         LuceneDocument doc = parsedDoc.rootDoc();

+ 0 - 1
server/src/test/java/org/elasticsearch/index/mapper/RoutingFieldMapperTests.java

@@ -43,7 +43,6 @@ public class RoutingFieldMapperTests extends MetadataMapperTestCase {
 
         ParsedDocument doc = docMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field("field", "value").endObject()),
                 XContentType.JSON,

+ 1 - 3
server/src/test/java/org/elasticsearch/index/mapper/SourceFieldMapperTests.java

@@ -42,7 +42,6 @@ public class SourceFieldMapperTests extends MetadataMapperTestCase {
         DocumentMapper documentMapper = createDocumentMapper(topMapping(b -> b.startObject("_source").endObject()));
         ParsedDocument doc = documentMapper.parse(
             new SourceToParse(
-                "_doc",
                 "1",
                 BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field("field", "value").endObject()),
                 XContentType.JSON
@@ -53,7 +52,6 @@ public class SourceFieldMapperTests extends MetadataMapperTestCase {
 
         doc = documentMapper.parse(
             new SourceToParse(
-                "_doc",
                 "1",
                 BytesReference.bytes(XContentFactory.smileBuilder().startObject().field("field", "value").endObject()),
                 XContentType.SMILE
@@ -126,7 +124,7 @@ public class SourceFieldMapperTests extends MetadataMapperTestCase {
         MapperParsingException exception = expectThrows(
             MapperParsingException.class,
             // extra end object (invalid JSON))
-            () -> documentMapper.parse(new SourceToParse("test", "1", new BytesArray("{}}"), XContentType.JSON))
+            () -> documentMapper.parse(new SourceToParse("1", new BytesArray("{}}"), XContentType.JSON))
         );
         assertNotNull(exception.getRootCause());
         assertThat(exception.getRootCause().getMessage(), containsString("Unexpected close marker '}'"));

+ 0 - 1
server/src/test/java/org/elasticsearch/index/mapper/StoredNumericValuesTests.java

@@ -38,7 +38,6 @@ public class StoredNumericValuesTests extends MapperServiceTestCase {
         ParsedDocument doc = mapperService.documentMapper()
             .parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     BytesReference.bytes(
                         XContentFactory.jsonBuilder()

+ 1 - 1
server/src/test/java/org/elasticsearch/index/mapper/flattened/FlattenedFieldMapperTests.java

@@ -176,7 +176,7 @@ public class FlattenedFieldMapperTests extends MapperTestCase {
         expectThrows(MapperParsingException.class, () -> mapper.parse(source(b -> b.field("field", "not a JSON object"))));
 
         BytesReference doc2 = new BytesArray("{ \"field\": { \"key\": \"value\" ");
-        expectThrows(MapperParsingException.class, () -> mapper.parse(new SourceToParse("test", "1", doc2, XContentType.JSON)));
+        expectThrows(MapperParsingException.class, () -> mapper.parse(new SourceToParse("1", doc2, XContentType.JSON)));
     }
 
     public void testFieldMultiplicity() throws Exception {

+ 2 - 2
server/src/test/java/org/elasticsearch/index/replication/RecoveryDuringReplicationTests.java

@@ -132,7 +132,7 @@ public class RecoveryDuringReplicationTests extends ESIndexLevelReplicationTestC
                 1,
                 randomNonNegativeLong(),
                 false,
-                new SourceToParse("index", "replica", new BytesArray("{}"), XContentType.JSON)
+                new SourceToParse("replica", new BytesArray("{}"), XContentType.JSON)
             );
             shards.promoteReplicaToPrimary(promotedReplica).get();
             oldPrimary.close("demoted", randomBoolean());
@@ -146,7 +146,7 @@ public class RecoveryDuringReplicationTests extends ESIndexLevelReplicationTestC
                 promotedReplica.applyIndexOperationOnPrimary(
                     Versions.MATCH_ANY,
                     VersionType.INTERNAL,
-                    new SourceToParse("index", "primary", new BytesArray("{}"), XContentType.JSON),
+                    new SourceToParse("primary", new BytesArray("{}"), XContentType.JSON),
                     SequenceNumbers.UNASSIGNED_SEQ_NO,
                     0,
                     IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,

+ 10 - 15
server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java

@@ -2139,7 +2139,7 @@ public class IndexShardTests extends IndexShardTestCase {
             1,
             IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,
             false,
-            new SourceToParse(shard.shardId().getIndexName(), "id", new BytesArray("{}"), XContentType.JSON)
+            new SourceToParse("id", new BytesArray("{}"), XContentType.JSON)
         );
         shard.applyIndexOperationOnReplica(
             3,
@@ -2147,7 +2147,7 @@ public class IndexShardTests extends IndexShardTestCase {
             3,
             IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,
             false,
-            new SourceToParse(shard.shardId().getIndexName(), "id-3", new BytesArray("{}"), XContentType.JSON)
+            new SourceToParse("id-3", new BytesArray("{}"), XContentType.JSON)
         );
         // Flushing a new commit with local checkpoint=1 allows to skip the translog gen #1 in recovery.
         shard.flush(new FlushRequest().force(true).waitIfOngoing(true));
@@ -2157,7 +2157,7 @@ public class IndexShardTests extends IndexShardTestCase {
             3,
             IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,
             false,
-            new SourceToParse(shard.shardId().getIndexName(), "id-2", new BytesArray("{}"), XContentType.JSON)
+            new SourceToParse("id-2", new BytesArray("{}"), XContentType.JSON)
         );
         shard.applyIndexOperationOnReplica(
             5,
@@ -2165,7 +2165,7 @@ public class IndexShardTests extends IndexShardTestCase {
             1,
             IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,
             false,
-            new SourceToParse(shard.shardId().getIndexName(), "id-5", new BytesArray("{}"), XContentType.JSON)
+            new SourceToParse("id-5", new BytesArray("{}"), XContentType.JSON)
         );
         shard.sync(); // advance local checkpoint
 
@@ -2305,7 +2305,7 @@ public class IndexShardTests extends IndexShardTestCase {
         // start a replica shard and index the second doc
         final IndexShard otherShard = newStartedShard(false);
         updateMappings(otherShard, shard.indexSettings().getIndexMetadata());
-        SourceToParse sourceToParse = new SourceToParse(shard.shardId().getIndexName(), "1", new BytesArray("{}"), XContentType.JSON);
+        SourceToParse sourceToParse = new SourceToParse("1", new BytesArray("{}"), XContentType.JSON);
         otherShard.applyIndexOperationOnReplica(
             1,
             otherShard.getOperationPrimaryTerm(),
@@ -2439,7 +2439,7 @@ public class IndexShardTests extends IndexShardTestCase {
             1,
             IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,
             false,
-            new SourceToParse(indexName, "doc-0", new BytesArray("{}"), XContentType.JSON)
+            new SourceToParse("doc-0", new BytesArray("{}"), XContentType.JSON)
         );
         flushShard(shard);
         shard.updateGlobalCheckpointOnReplica(0, "test"); // stick the global checkpoint here.
@@ -2449,7 +2449,7 @@ public class IndexShardTests extends IndexShardTestCase {
             1,
             IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,
             false,
-            new SourceToParse(indexName, "doc-1", new BytesArray("{}"), XContentType.JSON)
+            new SourceToParse("doc-1", new BytesArray("{}"), XContentType.JSON)
         );
         flushShard(shard);
         assertThat(getShardDocUIDs(shard), containsInAnyOrder("doc-0", "doc-1"));
@@ -2461,7 +2461,7 @@ public class IndexShardTests extends IndexShardTestCase {
             1,
             IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,
             false,
-            new SourceToParse(indexName, "doc-2", new BytesArray("{}"), XContentType.JSON)
+            new SourceToParse("doc-2", new BytesArray("{}"), XContentType.JSON)
         );
         flushShard(shard);
         assertThat(getShardDocUIDs(shard), containsInAnyOrder("doc-0", "doc-1", "doc-2"));
@@ -3669,12 +3669,7 @@ public class IndexShardTests extends IndexShardTestCase {
                 if (ids.add(id) == false) { // this is an update
                     indexShard.advanceMaxSeqNoOfUpdatesOrDeletes(i);
                 }
-                SourceToParse sourceToParse = new SourceToParse(
-                    indexShard.shardId().getIndexName(),
-                    id,
-                    new BytesArray("{}"),
-                    XContentType.JSON
-                );
+                SourceToParse sourceToParse = new SourceToParse(id, new BytesArray("{}"), XContentType.JSON);
                 indexShard.applyIndexOperationOnReplica(
                     i,
                     indexShard.getOperationPrimaryTerm(),
@@ -4369,7 +4364,7 @@ public class IndexShardTests extends IndexShardTestCase {
                 1,
                 IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,
                 false,
-                new SourceToParse(shard.shardId.getIndexName(), Long.toString(i), new BytesArray("{}"), XContentType.JSON)
+                new SourceToParse(Long.toString(i), new BytesArray("{}"), XContentType.JSON)
             );
             shard.updateGlobalCheckpointOnReplica(shard.getLocalCheckpoint(), "test");
             if (randomInt(100) < 10) {

+ 2 - 2
server/src/test/java/org/elasticsearch/index/shard/PrimaryReplicaSyncerTests.java

@@ -79,7 +79,7 @@ public class PrimaryReplicaSyncerTests extends IndexShardTestCase {
             shard.applyIndexOperationOnPrimary(
                 Versions.MATCH_ANY,
                 VersionType.INTERNAL,
-                new SourceToParse(shard.shardId().getIndexName(), Integer.toString(i), new BytesArray("{}"), XContentType.JSON),
+                new SourceToParse(Integer.toString(i), new BytesArray("{}"), XContentType.JSON),
                 SequenceNumbers.UNASSIGNED_SEQ_NO,
                 0,
                 IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,
@@ -169,7 +169,7 @@ public class PrimaryReplicaSyncerTests extends IndexShardTestCase {
             shard.applyIndexOperationOnPrimary(
                 Versions.MATCH_ANY,
                 VersionType.INTERNAL,
-                new SourceToParse(shard.shardId().getIndexName(), Integer.toString(i), new BytesArray("{}"), XContentType.JSON),
+                new SourceToParse(Integer.toString(i), new BytesArray("{}"), XContentType.JSON),
                 SequenceNumbers.UNASSIGNED_SEQ_NO,
                 0,
                 IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,

+ 1 - 1
server/src/test/java/org/elasticsearch/indices/recovery/PeerRecoveryTargetServiceTests.java

@@ -190,7 +190,7 @@ public class PeerRecoveryTargetServiceTests extends IndexShardTestCase {
                 shard.getOperationPrimaryTerm(),
                 IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,
                 false,
-                new SourceToParse(shard.shardId().getIndexName(), UUIDs.randomBase64UUID(), new BytesArray("{}"), XContentType.JSON)
+                new SourceToParse(UUIDs.randomBase64UUID(), new BytesArray("{}"), XContentType.JSON)
             );
             if (randomInt(100) < 5) {
                 shard.flush(new FlushRequest().waitIfOngoing(true));

+ 5 - 5
server/src/test/java/org/elasticsearch/indices/recovery/RecoveryTests.java

@@ -146,7 +146,7 @@ public class RecoveryTests extends ESIndexLevelReplicationTestCase {
                 1,
                 IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,
                 false,
-                new SourceToParse(indexName, "id", new BytesArray("{}"), XContentType.JSON)
+                new SourceToParse("id", new BytesArray("{}"), XContentType.JSON)
             );
             // index #3
             orgReplica.applyIndexOperationOnReplica(
@@ -155,7 +155,7 @@ public class RecoveryTests extends ESIndexLevelReplicationTestCase {
                 1,
                 IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,
                 false,
-                new SourceToParse(indexName, "id-3", new BytesArray("{}"), XContentType.JSON)
+                new SourceToParse("id-3", new BytesArray("{}"), XContentType.JSON)
             );
             // Flushing a new commit with local checkpoint=1 allows to delete the translog gen #1.
             orgReplica.flush(new FlushRequest().force(true).waitIfOngoing(true));
@@ -166,7 +166,7 @@ public class RecoveryTests extends ESIndexLevelReplicationTestCase {
                 1,
                 IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,
                 false,
-                new SourceToParse(indexName, "id-2", new BytesArray("{}"), XContentType.JSON)
+                new SourceToParse("id-2", new BytesArray("{}"), XContentType.JSON)
             );
             orgReplica.sync(); // advance local checkpoint
             orgReplica.updateGlobalCheckpointOnReplica(3L, "test");
@@ -177,7 +177,7 @@ public class RecoveryTests extends ESIndexLevelReplicationTestCase {
                 1,
                 IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,
                 false,
-                new SourceToParse(indexName, "id-5", new BytesArray("{}"), XContentType.JSON)
+                new SourceToParse("id-5", new BytesArray("{}"), XContentType.JSON)
             );
 
             if (randomBoolean()) {
@@ -295,7 +295,7 @@ public class RecoveryTests extends ESIndexLevelReplicationTestCase {
             Engine.IndexResult result = primaryShard.applyIndexOperationOnPrimary(
                 Versions.MATCH_ANY,
                 VersionType.INTERNAL,
-                new SourceToParse(primaryShard.shardId().getIndexName(), Integer.toString(i), new BytesArray("{}"), XContentType.JSON),
+                new SourceToParse(Integer.toString(i), new BytesArray("{}"), XContentType.JSON),
                 SequenceNumbers.UNASSIGNED_SEQ_NO,
                 0,
                 IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,

+ 3 - 11
server/src/test/java/org/elasticsearch/search/suggest/completion/CategoryContextMappingTests.java

@@ -74,7 +74,6 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase {
         Mapper fieldMapper = defaultMapper.mappers().getMapper("completion");
         ParsedDocument parsedDocument = defaultMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     jsonBuilder().startObject()
@@ -125,7 +124,6 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase {
         Mapper fieldMapper = defaultMapper.mappers().getMapper("completion");
         ParsedDocument parsedDocument = defaultMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     jsonBuilder().startObject()
@@ -171,7 +169,6 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase {
         Mapper fieldMapper = defaultMapper.mappers().getMapper("completion");
         ParsedDocument parsedDocument = defaultMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     jsonBuilder().startObject()
@@ -217,7 +214,6 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase {
         Mapper fieldMapper = defaultMapper.mappers().getMapper("completion");
         ParsedDocument parsedDocument = defaultMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     jsonBuilder().startObject()
@@ -274,7 +270,7 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase {
 
         Exception e = expectThrows(
             MapperParsingException.class,
-            () -> defaultMapper.parse(new SourceToParse("test", "1", BytesReference.bytes(builder), XContentType.JSON))
+            () -> defaultMapper.parse(new SourceToParse("1", BytesReference.bytes(builder), XContentType.JSON))
         );
         assertEquals(
             "contexts must be a string, number or boolean or a list of string, number or boolean, but was [VALUE_NULL]",
@@ -306,7 +302,6 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase {
         Mapper fieldMapper = defaultMapper.mappers().getMapper("completion");
         ParsedDocument parsedDocument = defaultMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     jsonBuilder().startObject()
@@ -350,7 +345,6 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase {
         Mapper fieldMapper = defaultMapper.mappers().getMapper("completion");
         ParsedDocument parsedDocument = defaultMapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(
                     jsonBuilder().startObject()
@@ -403,7 +397,7 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase {
 
         Exception e = expectThrows(
             MapperParsingException.class,
-            () -> defaultMapper.parse(new SourceToParse("test", "1", BytesReference.bytes(builder), XContentType.JSON))
+            () -> defaultMapper.parse(new SourceToParse("1", BytesReference.bytes(builder), XContentType.JSON))
         );
         assertEquals("context array must have string, number or boolean values, but was [VALUE_NULL]", e.getCause().getMessage());
     }
@@ -446,9 +440,7 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase {
             .endObject()
             .endArray()
             .endObject();
-        ParsedDocument parsedDocument = defaultMapper.parse(
-            new SourceToParse("test", "1", BytesReference.bytes(builder), XContentType.JSON)
-        );
+        ParsedDocument parsedDocument = defaultMapper.parse(new SourceToParse("1", BytesReference.bytes(builder), XContentType.JSON));
         IndexableField[] fields = parsedDocument.rootDoc().getFields(fieldMapper.name());
         assertContextSuggestFields(fields, 3);
     }

+ 1 - 4
server/src/test/java/org/elasticsearch/search/suggest/completion/GeoContextMappingTests.java

@@ -60,7 +60,6 @@ public class GeoContextMappingTests extends ESSingleNodeTestCase {
         ParsedDocument parsedDocument = mapperService.documentMapper()
             .parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     BytesReference.bytes(
                         jsonBuilder().startObject()
@@ -109,7 +108,6 @@ public class GeoContextMappingTests extends ESSingleNodeTestCase {
         ParsedDocument parsedDocument = mapperService.documentMapper()
             .parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     BytesReference.bytes(
                         jsonBuilder().startObject()
@@ -156,7 +154,6 @@ public class GeoContextMappingTests extends ESSingleNodeTestCase {
         ParsedDocument parsedDocument = mapperService.documentMapper()
             .parse(
                 new SourceToParse(
-                    "test",
                     "1",
                     BytesReference.bytes(
                         jsonBuilder().startObject()
@@ -221,7 +218,7 @@ public class GeoContextMappingTests extends ESSingleNodeTestCase {
             .endArray()
             .endObject();
         ParsedDocument parsedDocument = mapperService.documentMapper()
-            .parse(new SourceToParse("test", "1", BytesReference.bytes(builder), XContentType.JSON));
+            .parse(new SourceToParse("1", BytesReference.bytes(builder), XContentType.JSON));
         IndexableField[] fields = parsedDocument.rootDoc().getFields(completionFieldType.name());
         assertContextSuggestFields(fields, 3);
     }

+ 1 - 1
test/framework/src/main/java/org/elasticsearch/index/engine/EngineTestCase.java

@@ -435,7 +435,7 @@ public abstract class EngineTestCase extends ESTestCase {
                 source.endObject();
             }
             source.endObject();
-            return nestedMapper.parse(new SourceToParse("test", docId, BytesReference.bytes(source), XContentType.JSON));
+            return nestedMapper.parse(new SourceToParse(docId, BytesReference.bytes(source), XContentType.JSON));
         };
     }
 

+ 1 - 8
test/framework/src/main/java/org/elasticsearch/index/engine/TranslogHandler.java

@@ -101,14 +101,7 @@ public class TranslogHandler implements Engine.TranslogRecoveryRunner {
                 final String indexName = mapperService.index().getName();
                 final Engine.Index engineIndex = IndexShard.prepareIndex(
                     mapperService,
-                    new SourceToParse(
-                        indexName,
-                        index.id(),
-                        index.source(),
-                        XContentHelper.xContentType(index.source()),
-                        index.routing(),
-                        Map.of()
-                    ),
+                    new SourceToParse(index.id(), index.source(), XContentHelper.xContentType(index.source()), index.routing(), Map.of()),
                     index.seqNo(),
                     index.primaryTerm(),
                     index.version(),

+ 2 - 2
test/framework/src/main/java/org/elasticsearch/index/mapper/MapperServiceTestCase.java

@@ -249,11 +249,11 @@ public abstract class MapperServiceTestCase extends ESTestCase {
         XContentBuilder builder = JsonXContent.contentBuilder().startObject();
         build.accept(builder);
         builder.endObject();
-        return new SourceToParse("test", id, BytesReference.bytes(builder), XContentType.JSON, routing, dynamicTemplates);
+        return new SourceToParse(id, BytesReference.bytes(builder), XContentType.JSON, routing, dynamicTemplates);
     }
 
     protected final SourceToParse source(String source) {
-        return new SourceToParse("test", "1", new BytesArray(source), XContentType.JSON);
+        return new SourceToParse("1", new BytesArray(source), XContentType.JSON);
     }
 
     /**

+ 1 - 8
test/framework/src/main/java/org/elasticsearch/index/shard/IndexShardTestCase.java

@@ -867,14 +867,7 @@ public abstract class IndexShardTestCase extends ESTestCase {
 
     protected Engine.IndexResult indexDoc(IndexShard shard, String id, String source, XContentType xContentType, String routing)
         throws IOException {
-        SourceToParse sourceToParse = new SourceToParse(
-            shard.shardId().getIndexName(),
-            id,
-            new BytesArray(source),
-            xContentType,
-            routing,
-            Map.of()
-        );
+        SourceToParse sourceToParse = new SourceToParse(id, new BytesArray(source), xContentType, routing, Map.of());
         Engine.IndexResult result;
         if (shard.routingEntry().primary()) {
             result = shard.applyIndexOperationOnPrimary(

+ 2 - 7
x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/index/engine/FollowEngineIndexShardTests.java

@@ -56,12 +56,7 @@ public class FollowEngineIndexShardTests extends IndexShardTestCase {
         long seqNo = -1;
         for (int i = 0; i < 8; i++) {
             final String id = Long.toString(i);
-            SourceToParse sourceToParse = new SourceToParse(
-                indexShard.shardId().getIndexName(),
-                id,
-                new BytesArray("{}"),
-                XContentType.JSON
-            );
+            SourceToParse sourceToParse = new SourceToParse(id, new BytesArray("{}"), XContentType.JSON);
             indexShard.applyIndexOperationOnReplica(
                 ++seqNo,
                 indexShard.getOperationPrimaryTerm(),
@@ -73,7 +68,7 @@ public class FollowEngineIndexShardTests extends IndexShardTestCase {
         }
         long seqNoBeforeGap = seqNo;
         seqNo += 8;
-        SourceToParse sourceToParse = new SourceToParse(indexShard.shardId().getIndexName(), "9", new BytesArray("{}"), XContentType.JSON);
+        SourceToParse sourceToParse = new SourceToParse("9", new BytesArray("{}"), XContentType.JSON);
         indexShard.applyIndexOperationOnReplica(
             seqNo,
             indexShard.getOperationPrimaryTerm(),

+ 1 - 8
x-pack/plugin/core/src/test/java/org/elasticsearch/snapshots/sourceonly/SourceOnlySnapshotShardTests.java

@@ -463,14 +463,7 @@ public class SourceOnlySnapshotShardTests extends IndexShardTestCase {
                         Engine.Result result = targetShard.applyIndexOperationOnPrimary(
                             Versions.MATCH_ANY,
                             VersionType.INTERNAL,
-                            new SourceToParse(
-                                index,
-                                id,
-                                source,
-                                XContentHelper.xContentType(source),
-                                rootFieldsVisitor.routing(),
-                                Map.of()
-                            ),
+                            new SourceToParse(id, source, XContentHelper.xContentType(source), rootFieldsVisitor.routing(), Map.of()),
                             SequenceNumbers.UNASSIGNED_SEQ_NO,
                             0,
                             IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,

+ 2 - 3
x-pack/plugin/mapper-version/src/test/java/org/elasticsearch/xpack/versionfield/VersionStringFieldMapperTests.java

@@ -64,7 +64,6 @@ public class VersionStringFieldMapperTests extends MapperTestCase {
 
         ParsedDocument doc = mapper.parse(
             new SourceToParse(
-                "test",
                 "1",
                 BytesReference.bytes(XContentFactory.jsonBuilder().startObject().field("field", "1.2.3").endObject()),
                 XContentType.JSON
@@ -101,7 +100,7 @@ public class VersionStringFieldMapperTests extends MapperTestCase {
         );
         MapperParsingException ex = expectThrows(
             MapperParsingException.class,
-            () -> defaultMapper.parse(new SourceToParse("test", "1", source, XContentType.JSON))
+            () -> defaultMapper.parse(new SourceToParse("1", source, XContentType.JSON))
         );
         assertEquals(
             "failed to parse field [field] of type [version] in document with id '1'. " + "Preview of field's value: '{}'",
@@ -126,7 +125,7 @@ public class VersionStringFieldMapperTests extends MapperTestCase {
         );
         MapperParsingException ex = expectThrows(
             MapperParsingException.class,
-            () -> defaultMapper.parse(new SourceToParse("test", "1", source, XContentType.JSON))
+            () -> defaultMapper.parse(new SourceToParse("1", source, XContentType.JSON))
         );
         assertEquals(
             "failed to parse field [field] of type [version] in document with id '1'. "

+ 3 - 3
x-pack/plugin/spatial/src/test/java/org/elasticsearch/xpack/spatial/index/mapper/GeoShapeWithDocValuesFieldMapperTests.java

@@ -233,7 +233,7 @@ public class GeoShapeWithDocValuesFieldMapperTests extends MapperTestCase {
             BytesReference arrayedDoc = BytesReference.bytes(
                 XContentFactory.jsonBuilder().startObject().field("field", "Bad shape").endObject()
             );
-            SourceToParse sourceToParse = new SourceToParse("test", "1", arrayedDoc, XContentType.JSON);
+            SourceToParse sourceToParse = new SourceToParse("1", arrayedDoc, XContentType.JSON);
             ParsedDocument document = ignoreMapper.parse(sourceToParse);
             assertThat(document.docs().get(0).getFields("field").length, equalTo(0));
             MapperParsingException exception = expectThrows(MapperParsingException.class, () -> failMapper.parse(sourceToParse));
@@ -250,7 +250,7 @@ public class GeoShapeWithDocValuesFieldMapperTests extends MapperTestCase {
                     )
                     .endObject()
             );
-            SourceToParse sourceToParse = new SourceToParse("test", "1", arrayedDoc, XContentType.JSON);
+            SourceToParse sourceToParse = new SourceToParse("1", arrayedDoc, XContentType.JSON);
             ParsedDocument document = ignoreMapper.parse(sourceToParse);
             assertThat(document.docs().get(0).getFields("field").length, equalTo(0));
             MapperParsingException exception = expectThrows(MapperParsingException.class, () -> failMapper.parse(sourceToParse));
@@ -386,7 +386,7 @@ public class GeoShapeWithDocValuesFieldMapperTests extends MapperTestCase {
                 .endObject()
         );
 
-        SourceToParse sourceToParse = new SourceToParse("test", "1", arrayedDoc, XContentType.JSON);
+        SourceToParse sourceToParse = new SourceToParse("1", arrayedDoc, XContentType.JSON);
         ParsedDocument document = mapper.parse(sourceToParse);
         assertThat(document.docs(), hasSize(1));
         IndexableField[] fields = document.docs().get(0).getFields("shape.type");

+ 1 - 1
x-pack/plugin/vectors/src/internalClusterTest/java/org/elasticsearch/xpack/vectors/mapper/SparseVectorFieldMapperTests.java

@@ -121,7 +121,7 @@ public class SparseVectorFieldMapperTests extends ESSingleNodeTestCase {
 
         MapperParsingException indexException = expectThrows(
             MapperParsingException.class,
-            () -> mapper.parse(new SourceToParse("index", "id", source, XContentType.JSON))
+            () -> mapper.parse(new SourceToParse("id", source, XContentType.JSON))
         );
         assertThat(indexException.getCause().getMessage(), containsString(SparseVectorFieldMapper.ERROR_MESSAGE));
     }