Skip to content

Commit

Permalink
Update opensearch.js
Browse files Browse the repository at this point in the history
  • Loading branch information
varmoh authored Jan 2, 2025
1 parent 279b5fd commit b874e5a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion DSL/Pipelines/pipelines/opensearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ router.post(
console.log(index_type);
console.log(obj);

if (index_type) obj.id = obj[index_type].replaceAll(/\s+/g, "_");
if (index_type && obj[index_type]) {
obj.id = obj[index_type].replaceAll(/\s+/g, "_");
} else {
console.error(`Missing property '${index_type}' in object`, obj);
// You can either skip or handle this case as appropriate
}
if (obj.examples && !Array.isArray(obj.examples)) {
obj.examples = obj.examples
.split("\n")
Expand Down

0 comments on commit b874e5a

Please sign in to comment.