We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f6bc025 commit 7021b40Copy full SHA for 7021b40
src/utils.js
@@ -115,12 +115,13 @@ export async function fetchElasticMapping(
115
);
116
}
117
118
- const elasticMapping = (
119
- await opts.elasticClient.indices.getMapping({
120
- index: opts.elasticIndex,
121
- type: opts.elasticType,
122
- })
123
- )[opts.elasticIndex].mappings[opts.elasticType];
+ const elasticMapping = await opts.elasticClient.indices.getMapping({
+ index: opts.elasticIndex,
+ type: opts.elasticType,
+ });
+
+ // Try index name, else resort to Value in case Index name is an alias
124
+ const baseIndex = elasticMapping[opts.elasticIndex] || Object.values(elasticMapping)[0];
125
- return elasticMapping;
126
+ return baseIndex.mappings[opts.elasticType];
127
0 commit comments