title: How to limit search results with Google Maps Autocomplete API
body: <p>I am currently restricting the suburb lookup within Australia using <a href="https://developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service#ComponentRestrictions.country" rel="nofollow noreferrer">ComponentRestrictions</a> but wondering if I can further refine the returned results.</p>
  <p>For example,</p>
  <p><a href="https://i.stack.imgur.com/aV7Nh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aV7Nh.png" alt="enter image description here" /></a></p>
  <p>if I enter <code>Coogee</code> in the search, I can see multiple results coming out. But if I only want <code>Coogee</code> in <strong>NSW</strong> instead <strong>WA</strong>, how should I do that?</p>
  <p>There's a mention of <code>Place Types</code> with <a href="https://developers.google.com/maps/documentation/javascript/supported_types" rel="nofollow noreferrer">this documentation</a>. But I am not too sure which might be the right type(s) to use in my case</p>
  <p>Code snippet</p>
  <pre><code>const input = document.getElementById('inputSuburb');
  const options = {
      fields: [&quot;address_components&quot;, &quot;geometry&quot;, &quot;types&quot;, &quot;name&quot;],
      componentRestrictions: { country: 'au' },
      types: ['locality', 'postal_code']
  };
  
  autocomplete = new google.maps.places.Autocomplete(input, options);
  
  autocomplete.addListener('place_changed', function () {
     const place = autocomplete.getPlace();
     console.log(place);
  }
  </code></pre>