# Structured search

> Geocoding from separate address fields.

`GET /v1/search/structured` takes the parts of an address in separate fields. Set at least one of `address`, `locality`, `region`, `postalcode` or `country`; otherwise the request fails with `400`.

## Parameters

| Parameter | Type | Meaning |
| --- | --- | --- |
| `address` | string | House number and street, or a venue name. |
| `neighbourhood` | string | Neighbourhood. |
| `borough` | string | Borough. |
| `locality` | string | City or town. |
| `county` | string | County. |
| `region` | string | State or province. |
| `postalcode` | string | Postal code. |
| `country` | string | Country name, or an ISO 3166-1 alpha-2 code. A two-letter code filters by country instead of matching words. |

`size`, `layers`, `boundary.country` and the focus point work as in [Search](/search/api/search).

## Example

```bash
curl 'http://localhost:4000/v1/search/structured?locality=pune&address=fc%20road&size=2'
```

```json
{
  "bbox": [
    73.8411071,
    18.5197804,
    73.8434839,
    18.5289175
  ],
  "features": [
    {
      "geometry": {
        "coordinates": [
          73.8434839,
          18.5289175
        ],
        "type": "Point"
      },
      "properties": {
        "confidence": 1.0,
        "country": "India",
        "country_code": "IN",
        "county": "Pune",
        "gid": "geolith:venue:-6291417109141549192",
        "id": "-6291417109141549192",
        "importance": 0.9962999820709229,
        "label": "FC Road Social, Pune, Maharashtra, India",
        "layer": "venue",
        "locality": "Pune",
        "name": "FC Road Social",
        "region": "Maharashtra",
        "source": "geolith"
      },
      "type": "Feature"
    },
    {
      "geometry": {
        "coordinates": [
          73.8411071,
          18.5197804
        ],
        "type": "Point"
      },
      "properties": {
        "confidence": 1.0,
        "country": "India",
        "country_code": "IN",
        "county": "Pune",
        "gid": "geolith:venue:-9143424206843833411",
        "id": "-9143424206843833411",
        "importance": 0.9810000061988831,
        "label": "Aurelia Fc Road Pune, Pune, Maharashtra, India",
        "layer": "venue",
        "locality": "Pune",
        "name": "Aurelia Fc Road Pune",
        "region": "Maharashtra",
        "source": "geolith"
      },
      "type": "Feature"
    }
  ],
  "geocoding": {
    "attribution": "https://console.geolith.app/attribution",
    "engine": {
      "name": "geolith-search",
      "version": "0.1.0"
    },
    "query": {
      "fields": [
        "fc road",
        "pune"
      ],
      "ranking": "importance",
      "size": 2
    },
    "version": "0.2"
  },
  "type": "FeatureCollection"
}
```

The response is trimmed to two features.

Every word of every field is required first. When that finds nothing, the query relaxes to about three quarters of the words.
