int extractIndexFieldPos(String index, String[] fieldNames, boolean isDynamicIndexWithFormat) {
			List<String> fieldList = Arrays.asList(fieldNames);
			String indexFieldName;
			if (isDynamicIndexWithFormat) {
				indexFieldName = index.substring(index.indexOf("{") + 1, index.indexOf("|"));
			} else {
				indexFieldName = index.substring(index.indexOf("{") + 1, index.indexOf("}"));
			}
			if (!fieldList.contains(indexFieldName)) {
				throw new TableException(String.format("Unknown field '%s' in index pattern '%s', please check the field name.",
					indexFieldName, index));
			}
			return fieldList.indexOf(indexFieldName);
		}
Extract index field position in a fieldNames, return the field position.
elasticsearch7/elasticsearch7-sink/src/main/java/org/apache/flink/streaming/connectors/elasticsearch/index/IndexGeneratorFactory.java