Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
package org.elasticsearch.plugins.internal;

import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.engine.EngineFactory;
import org.elasticsearch.index.engine.InternalEngine;
Expand Down Expand Up @@ -104,7 +105,7 @@ public IndexResult index(Index index) throws IOException {
IndexResult result = super.index(index);

DocumentSizeReporter documentParsingReporter = documentParsingProvider.newDocumentSizeReporter(
shardId.getIndexName(),
shardId.getIndex(),
config().getMapperService(),
DocumentSizeAccumulator.EMPTY_INSTANCE
);
Expand All @@ -131,22 +132,22 @@ public <T> XContentMeteringParserDecorator newMeteringParserDecorator(IndexReque

@Override
public DocumentSizeReporter newDocumentSizeReporter(
String indexName,
Index index,
MapperService mapperService,
DocumentSizeAccumulator documentSizeAccumulator
) {
return new TestDocumentSizeReporter(indexName);
return new TestDocumentSizeReporter(index);
}
};
}
}

public static class TestDocumentSizeReporter implements DocumentSizeReporter {

private final String indexName;
private final Index index;

public TestDocumentSizeReporter(String indexName) {
this.indexName = indexName;
public TestDocumentSizeReporter(Index index) {
this.index = index;
}

@Override
Expand All @@ -155,7 +156,7 @@ public void onIndexingCompleted(ParsedDocument parsedDocument) {
if (delta > XContentMeteringParserDecorator.UNKNOWN_SIZE) {
COUNTER.addAndGet(delta);
}
assertThat(indexName, equalTo(TEST_INDEX_NAME));
assertThat(index.getName(), equalTo(TEST_INDEX_NAME));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
package org.elasticsearch.plugins.internal;

import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.mapper.MapperService;

/**
Expand All @@ -23,7 +24,7 @@ public interface DocumentParsingProvider {
* @return an instance of a reporter to use when parsing has been completed and indexing successful
*/
default DocumentSizeReporter newDocumentSizeReporter(
String indexName,
Index index,
MapperService mapperService,
DocumentSizeAccumulator documentSizeAccumulator
) {
Expand Down