1

I've got two migrations set up, pulling from two separate JSON feeds.

The first is a feed of taxonomy terms with a tid, vid, and name. I'm able to run migration on this fine and generate the relevant terms on my Drupal 8 test build.

The second JSON feed is one of node articles, that includes a taxonomy reference field, with a name value that matches up with the terms migrated in the previous migration described.

When I run the second migration for nodes, the taxonomy reference field is blank.

I've tried both entity_generate and migrate_lookup plugins to no success

field_taxonomy_term:
  plugin: migrate_lookup
  migration: migrate_taxonomy_terms_en
  source: tid

The JSON file for the taxonomy terms looks like the following:

[{
"name":"Term one",
"tid":"1",
"vid":"Vocabulary"
},
{
"name":"Term two",
"tid":"2",
"vid":"Vocabulary","}]

The JSON feed for the node migration looks like:

   {"title":"Page title","field_taxonomy_term":"Term one"}

Does anyone have ideas on what I'm missing?

Thanks!

1 Answer 1

1

I'm sorry that in 8 months no one has answered this question.

I was stuck on this as well and finally got it to work by using the following format nested under the process key of your migration that will look up the previously migrated taxonomy:

field_taxonomy_term:
  plugin: migrate_lookup
  migration: migrate_taxonomy_terms_en
  source: field_taxonomy_term

The field_taxonomy_term from your node source should be the entity id of the taxonomy term.

Also it should be noted that I migrated the taxonomy vocabulary and the node that will reference the taxonomy as a group. I'm not sure if that matters or not. The order the migrations are executed in is determined by setting the dependency on the taxonomy migration in the node migration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.