[source, ruby]
----
response = client.indices.create(
  index: 'places',
  body: {
    mappings: {
      properties: {
        geometry: {
          type: 'geo_shape'
        }
      }
    }
  }
)
puts response

response = client.bulk(
  index: 'places',
  refresh: true,
  body: [
    {
      index: {
        _id: 1
      }
    },
    {
      name: 'NEMO Science Museum',
      geometry: 'POINT(4.912350 52.374081)'
    },
    {
      index: {
        _id: 2
      }
    },
    {
      name: 'Sportpark De Weeren',
      geometry: {
        type: 'Polygon',
        coordinates: [
          [
            [
              4.965305328369141,
              52.39347642069457
            ],
            [
              4.966979026794433,
              52.391721758934835
            ],
            [
              4.969425201416015,
              52.39238958618537
            ],
            [
              4.967944622039794,
              52.39420969150824
            ],
            [
              4.965305328369141,
              52.39347642069457
            ]
          ]
        ]
      }
    }
  ]
)
puts response

response = client.search(
  index: 'places',
  size: 0,
  body: {
    aggregations: {
      viewport: {
        geo_bounds: {
          field: 'geometry'
        }
      }
    }
  }
)
puts response
----
