Solutions 25 - 31

Solution 25

GET olympic-events-fixed/_search
{
  "size": 50,
  "query": {
    "term": {
      "medal": {
        "value": "Gold"
      }
    }
  },
  "sort": [
    {
      "age": {
        "order": "desc"
      }
    }
  ]
}

Solution 26

GET olympic-events-fixed/_search
{
  "size": 50,
  "query": {
    "bool": {
      "filter": {
        "term": {
          "sport": {
            "value": "Swimming"
          }
        }
      },
      "should": [
        {
          "range": {
            "weight": {
              "_name": "weight",
              "gte": 50,
              "lte": 55
            }
          }
        },
        {
          "range": {
            "age": {
              "_name": "age",
              "gt": 30
            }
          }
        }
      ],
      "minimum_should_match": 1
    }
  }
}

Solution 27

PUT olympic-noc-regions
{
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0
  },
  "mappings": {
    "properties": {
      "noc": {
        "type": "keyword"
      },
      "region": {
        "type": "keyword"
      },
      "notes": {
        "type": "text"
      }
    }
  }
}

Solution 28

Follow the steps then run GET _cat/indices/olympic-noc-regions?v

Solution 29

Create the enrich policy:

PUT _enrich/policy/olympic-noc
{
  "match": {
    "indices": "olympic-noc-regions",
    "match_field": "noc",
    "enrich_fields": ["region", "notes"]
  }
}

Create the enrich index:

POST _enrich/policy/olympic-noc-append/_execute

Create the enrich pipeline:

PUT _ingest/pipeline/enrich-noc
{
  "processors": [
    {
      "enrich": {
        "policy_name": "olympic-noc-append",
        "field": "noc",
        "target_field": "nocDetails"
      }
    }
  ]
}

Solution 30

Create a new index using the index template:

PUT olympic-events-enriched

Then change the dynamic setting for the mapping to be true instead of strict:

PUT olympic-events-enriched/_mapping
{
  "dynamic": "true"
}

Solution 31

Run all documents in the index through the pipeline:

POST _reindex
{
  "source": {
    "index": "olympic-events-fixed"
  },
  "dest": {
    "index": "olympic-events-enriched",
    "pipeline": "enrich-noc"
  }
}
Licensed under CC BY-NC-SA 4.0
Built with Hugo
Theme based on Stack originally designed by Jimmy, forked by George Bridgeman