AWS GLUE to Open Search Index custom Index Id

0

I have a glue job which pushes the data from glue into open search. The index Id column is automatically created while inserting the data into open search. I would like to pass the index id _id field into open search while pushing the data using glue. what parameter should I be using or how can I pass a custom specific index_id to an open search index?

1 réponse
0
Réponse acceptée

Basically there two ways, I did this using dynamic mapping with dynamic documents

Define a Hidden Column

In your Glue Catalog table, add a hidden column named _id. This column will store the custom index ID you want to use for each record.

Access the Value in Glue Script

Within your Glue job script (Python or Scala), access the value of the hidden _id column for each record being processed.

Enable Dynamic Documents

When configuring the OpenSearch data sink in your Glue job, set the "Dynamic Documents" option to "true" within the connection properties. This allows Glue to dynamically add the _id field with your custom value during data insertion.

The other way is pre defined index mapping, let me know if you want to know about it.

Here are the references that might help you

  1. https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-crawler-pyspark-extensions-dynamic-frame-writer.html
  2. https://docs.aws.amazon.com/glue/latest/dg/connecting-to-data-opensearch.html
  3. https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html
profile picture
répondu il y a 2 mois
  • I would like to know about pre defined index mapping.Do you have an example?

  • When configuring the OpenSearch data sink in your Glue job, set the "Dynamic Documents" option to "true" within the connection properties. This allows Glue to dynamically add the _id field with your custom value during data insertion. Can you share an example for this

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions