File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
server/src/main/java/org/elasticsearch/index Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -262,6 +262,15 @@ public ShardFieldStats shardFieldStats() {
262
262
}
263
263
}
264
264
265
+ /**
266
+ * @throws AlreadyClosedException if the shard is closed
267
+ */
268
+ public FieldInfos shardFieldInfos () {
269
+ try (var searcher = acquireSearcher ("field_has_value" )) {
270
+ return FieldInfos .getMergedFieldInfos (searcher .getIndexReader ());
271
+ }
272
+ }
273
+
265
274
protected static ShardFieldStats shardFieldStats (List <LeafReaderContext > leaves ) {
266
275
int numSegments = 0 ;
267
276
int totalFields = 0 ;
Original file line number Diff line number Diff line change @@ -4308,9 +4308,9 @@ public void afterRefresh(boolean didRefresh) {
4308
4308
}
4309
4309
4310
4310
private FieldInfos loadFieldInfos () {
4311
- try ( Engine . Searcher hasValueSearcher = getEngine (). acquireSearcher ( "field_has_value" )) {
4312
- return FieldInfos . getMergedFieldInfos ( hasValueSearcher . getIndexReader () );
4313
- } catch (AlreadyClosedException ignore ) {
4311
+ try {
4312
+ return getEngine (). shardFieldInfos ( );
4313
+ } catch (AlreadyClosedException ignored ) {
4314
4314
// engine is closed - no update to FieldInfos is fine
4315
4315
}
4316
4316
return FieldInfos .EMPTY ;
You can’t perform that action at this time.
0 commit comments