Solutions 13 - 18

Solution 13

POST _reindex
{
  "source": {
    "index": "olympic-events"
  },
  "dest": {
    "index": "olympic-events-fixed",
    "pipeline": "split_games"
  }
}

Solution 14

PUT _template/olympic-events
{
  "index_patterns": ["olympic-events-*"],
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0
  },
  "mappings": {
    "dynamic": "strict",
    "properties": {
      "athleteId": {
        "type": "integer"
      },
      "age": {
        "type": "short"
      },
      "height": {
        "type": "short"
      },
      "weight": {
        "type": "short"
      },
      "athleteName": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword"
          }
        }
      },
      "gender": {
        "type": "keyword"
      },
      "team": {
        "type": "keyword"
      },
      "noc": {
        "type": "keyword"
      },
      "year": {
        "type": "short"
      },
      "season": {
        "type": "keyword"
      },
      "city": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword"
          }
        }
      },
      "sport": {
        "type": "keyword"
      },
      "event": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword"
          }
        }
      },
      "medal": {
        "type": "keyword"
      }
    }
  }
}

Solution 15

PUT _ingest/pipeline/reconcile_fields
{
  "processors": [
    {
      "rename": {
        "field": "ID",
        "target_field": "athleteId"
      }
    },
    {
      "rename": {
        "field": "Name",
        "target_field": "athleteName"
      }
    },
    {
      "rename": {
        "field": "Age",
        "target_field": "age"
      }
    },
    {
      "rename": {
        "field": "Height",
        "target_field": "height"
      }
    },
    {
      "rename": {
        "field": "Weight",
        "target_field": "weight"
      }
    },
    {
      "rename": {
        "field": "Sex",
        "target_field": "gender"
      }
    },
    {
      "rename": {
        "field": "Team",
        "target_field": "team"
      }
    },
    {
      "rename": {
        "field": "NOC",
        "target_field": "noc"
      }
    },
    {
      "rename": {
        "field": "Sport",
        "target_field": "sport"
      }
    },
    {
      "rename": {
        "field": "Event",
        "target_field": "event"
      }
    },
    {
      "rename": {
        "field": "City",
        "target_field": "city"
      }
    },
    {
      "rename": {
        "field": "Medal",
        "target_field": "medal"
      }
    },
    {
      "pipeline": {
        "name": "split_games"
      }
    }
  ]
}

Solution 16

POST _ingest/pipeline/reconcile_fields/_simulate
{
  "docs": [
    {
      "_source": {
        "NOC": "ARG",
        "Sex": "M",
        "City": "Los Angeles",
        "Weight": "98",
        "Name": "Ernesto Arturo Alas",
        "Sport": "Shooting",
        "Games": "1984 Summer",
        "Event": "Shooting Men's Free Pistol, 50 metres",
        "Height": "186",
        "Team": "Argentina",
        "ID": 2224,
        "Medal": "NA",
        "Age": "54"
      }
    }
  ]
}

Solution 17

DELETE olympic-events-fixed

Solution 18

POST _reindex
{
  "source": {
    "index": "olympic-events"
  },
  "dest": {
    "index": "olympic-events-fixed",
    "pipeline": "reconcile_fields"
  }
}

Next steps

The solutions to the next set of exercises can be found here.

Licensed under CC BY-NC-SA 4.0
All content on this site is my own and does not necessarily reflect the views of any of my employers or clients, past or present.
Built with Hugo
Theme based on Stack originally designed by Jimmy, forked by George Bridgeman