> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# insidePolygon

> Coordinates of polygons in which to search

export const Setting = ({type, default: defaultValue, defaultNote, scope, min, max, formerly}) => {
  const renderedDefault = defaultValue === '' ? '""' : defaultValue;
  const renderedNote = defaultNote ? `(${defaultNote})` : '';
  return <ul>
      <li><strong>Type:</strong> <code>{type}</code></li>
      <li><strong>Default:</strong> <code>{renderedDefault}</code>{renderedNote}</li>
      {min && <li><strong>Min:</strong> <code>{min}</code></li>}
      {max && <li><strong>Max:</strong> <code>{max}</code></li>}
      <li><strong>Scope:</strong> <a href="/doc/api-reference/api-parameters"><code>{scope}</code></a></li>
      {formerly && <li>
          <strong>Deprecated name:</strong> <code>{formerly}</code>
        </li>}
    </ul>;
};

<Setting type="list<number>" default="null" scope="search" />

The `insidePolygon` parameter restricts search results to records located within one or more geographic polygons.

Each polygon is defined by a series of latitude/longitude points (`lat1`, `lng1`, `lat2`, `lng2`, …),
with at least 3 points (6 values).
You can specify:

* A single polygon as a flat list of numbers
* Multiple polygons as a list of such lists

## Usage

* Minimum of 3 coordinate pairs (6 values) per polygon
* Up to 10,000 coordinate pairs supported per request
* If both `insidePolygon` and [`insideBoundingBox`](/doc/api-reference/api-parameters/insideBoundingBox) are specified, **only** `insideBoundingBox` is applied
* [`aroundLatLng`](/doc/api-reference/api-parameters/aroundLatLng) and [`aroundLatLngViaIP`](/doc/api-reference/api-parameters/aroundLatLngViaIP) will be ignored if used with `insidePolygon`.
* To match all records within the polygon, send an empty query (`""`)
* Avoid polygons that cross the [180th meridian](/doc/guides/managing-results/refine-results/geolocation/how-to/how-to-resolve-180-meridian-issue)

## Examples

### Search inside a single polygon

<AccordionGroup>
  <Accordion title="Current API clients" defaultOpen="true">
    <CodeGroup>
      ```cs C# theme={"system"}
      var response = await client.SearchSingleIndexAsync<Hit>(
        "INDEX_NAME",
        new SearchParams(
          new SearchParamsObject
          {
            InsidePolygon = new List<List<Double>>
            {
              new List<Double>
              {
                42.01,
                -124.31,
                48.835509470063045,
                -124.40453125000005,
                45.01082951668149,
                -65.95726562500005,
                31.247243545293433,
                -81.06578125000004,
                25.924152577235226,
                -97.68234374999997,
                32.300311895879545,
                -117.54828125,
              },
            },
          }
        )
      );
      ```

      ```dart Dart theme={"system"}
      final response = await client.searchSingleIndex(
        indexName: "INDEX_NAME",
        searchParams: SearchParamsObject(
          insidePolygon: [
            [
              42.01,
              -124.31,
              48.835509470063045,
              -124.40453125000005,
              45.01082951668149,
              -65.95726562500005,
              31.247243545293433,
              -81.06578125000004,
              25.924152577235226,
              -97.68234374999997,
              32.300311895879545,
              -117.54828125,
            ],
          ],
        ),
      );
      ```

      ```go Go theme={"system"}
      response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(
        "INDEX_NAME").WithSearchParams(search.SearchParamsObjectAsSearchParams(
        search.NewEmptySearchParamsObject().SetInsidePolygon(
          [][]float64{
            {
              42.01,
              -124.31,
              48.835509470063045,
              -124.40453125000005,
              45.01082951668149,
              -65.95726562500005,
              31.247243545293433,
              -81.06578125000004,
              25.924152577235226,
              -97.68234374999997,
              32.300311895879545,
              -117.54828125,
            },
          }))))
      if err != nil {
        // handle the eventual error
        panic(err)
      }
      ```

      ```java Java theme={"system"}
      SearchResponse response = client.searchSingleIndex(
        "INDEX_NAME",
        new SearchParamsObject().setInsidePolygon(
          Arrays.asList(
            Arrays.asList(
              42.01,
              -124.31,
              48.835509470063045,
              -124.40453125000005,
              45.01082951668149,
              -65.95726562500005,
              31.247243545293433,
              -81.06578125000004,
              25.924152577235226,
              -97.68234374999997,
              32.300311895879545,
              -117.54828125
            )
          )
        ),
        Hit.class
      );
      ```

      ```js JavaScript theme={"system"}
      const response = await client.searchSingleIndex({
        indexName: 'indexName',
        searchParams: {
          insidePolygon: [
            [
              42.01, -124.31, 48.835509470063045, -124.40453125000005, 45.01082951668149, -65.95726562500005,
              31.247243545293433, -81.06578125000004, 25.924152577235226, -97.68234374999997, 32.300311895879545,
              -117.54828125,
            ],
          ],
        },
      });
      ```

      ```kotlin Kotlin theme={"system"}
      var response =
        client.searchSingleIndex(
          indexName = "INDEX_NAME",
          searchParams =
            SearchParamsObject(
              insidePolygon =
                listOf(
                  listOf(
                    42.01,
                    -124.31,
                    48.835509470063045,
                    -124.40453125000005,
                    45.01082951668149,
                    -65.95726562500005,
                    31.247243545293433,
                    -81.06578125000004,
                    25.924152577235226,
                    -97.68234374999997,
                    32.300311895879545,
                    -117.54828125,
                  )
                )
            ),
        )
      ```

      ```php PHP theme={"system"}
      $response = $client->searchSingleIndex(
          'INDEX_NAME',
          ['insidePolygon' => [
              [
                  42.01,

                  -124.31,

                  48.835509470063045,

                  -124.40453125000005,

                  45.01082951668149,

                  -65.95726562500005,

                  31.247243545293433,

                  -81.06578125000004,

                  25.924152577235226,

                  -97.68234374999997,

                  32.300311895879545,

                  -117.54828125,
              ],
          ],
          ],
      );
      ```

      ```python Python theme={"system"}
      response = client.search_single_index(
          index_name="INDEX_NAME",
          search_params={
              "insidePolygon": [
                  [
                      42.01,
                      -124.31,
                      48.835509470063045,
                      -124.40453125000005,
                      45.01082951668149,
                      -65.95726562500005,
                      31.247243545293433,
                      -81.06578125000004,
                      25.924152577235226,
                      -97.68234374999997,
                      32.300311895879545,
                      -117.54828125,
                  ],
              ],
          },
      )
      ```

      ```ruby Ruby theme={"system"}
      response = client.search_single_index(
        "INDEX_NAME",
        Algolia::Search::SearchParamsObject.new(
          inside_polygon: [
            [
              42.01,
              -124.31,
              48.835509470063045,
              -124.40453125000005,
              45.01082951668149,
              -65.95726562500005,
              31.247243545293433,
              -81.06578125000004,
              25.924152577235226,
              -97.68234374999997,
              32.300311895879545,
              -117.54828125
            ]
          ]
        )
      )
      ```

      ```scala Scala theme={"system"}
      val response = Await.result(
        client.searchSingleIndex(
          indexName = "INDEX_NAME",
          searchParams = Some(
            SearchParamsObject(
              insidePolygon = Some(
                Seq(
                  Seq(42.01, -124.31, 48.835509470063045, -124.40453125000005, 45.01082951668149, -65.95726562500005,
                    31.247243545293433, -81.06578125000004, 25.924152577235226, -97.68234374999997, 32.300311895879545,
                    -117.54828125)
                )
              )
            )
          )
        ),
        Duration(100, "sec")
      )
      ```

      ```swift Swift theme={"system"}
      let response: SearchResponse<Hit> = try await client.searchSingleIndex(
          indexName: "INDEX_NAME",
          searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(insidePolygon: [[
              42.01,
              -124.31,
              48.835509470063045,
              -124.40453125000005,
              45.01082951668149,
              -65.95726562500005,
              31.247243545293433,
              -81.06578125000004,
              25.924152577235226,
              -97.68234374999997,
              32.300311895879545,
              -117.54828125,
          ]]))
      )
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Legacy API clients">
    <CodeGroup>
      ```cs C# theme={"system"}
      index.Search(new Query("query")
      {
          InsidePolygon = new List>
          {
              new List
              {
                  46.650828100116044f,
                  7.123046875f,
                  45.17210966999772f,
                  1.009765625f,
                  49.62625916704081f,
                  4.6181640625f
              }
          }
      });
      ```

      ```go Go theme={"system"}
      res, err := index.Search(
      	"query",
      	opt.InsidePolygon([][]float64{
      		{
      			46.650828100116044, // p1Lat
      			7.123046875,        // p1Lng
      			45.17210966999772,  // p2Lat
      			1.009765625,        // p2Lng
      			49.62625916704081,  // p3Lat
      			4.6181640625,       // p3Lng
      		},
      	}),
      )
      ```

      ```java Java theme={"system"}
      index.search(
          new Query("query")
              .setInsidePolygon(
                  Arrays.asList(
                      Arrays.asList(
                          46.650828100116044f,
                          7.123046875f,
                          45.17210966999772f,
                          1.009765625f,
                          49.62625916704081f,
                          4.6181640625f))));
      ```

      ```js JavaScript theme={"system"}
      const polygon = [
        46.650828100116044, // p1Lat
        7.123046875, // p1Lng
        45.17210966999772, // p2Lat
        1.009765625, // p2Lng
        49.62625916704081, // p3Lat
        4.6181640625, // p3Lng
      ];

      index
        .search("query", {
          insidePolygon: [polygon],
        })
        .then(({ hits }) => {
          console.log(hits);
        });
      ```

      ```kotlin Kotlin theme={"system"}
      val query = query("query") {
          insidePolygon {
              +Polygon(
                  Point(latitude = 46.650828100116044f, longitude = 7.123046875f),
                  Point(latitude = 45.17210966999772f, longitude = 1.009765625f),
                  Point(latitude = 49.62625916704081f, longitude = 4.6181640625f)
              )
          }
      }

      index.search(query)
      ```

      ```php PHP theme={"system"}
      $polygon = [
        46.650828100116044, // p1Lat
        7.123046875, // p1Lng
        45.17210966999772, // p2Lat
        1.009765625, // p2Lng
        49.62625916704081, // p3Lat
        4.6181640625 // p3Lng
      ];

      $results = $index->search('query', [
        'insidePolygon' => [$polygon]
      ]);
      ```

      ```python Python theme={"system"}
      polygon = [
          46.650828100116044,  # p1Lat
          7.123046875,  # p1Lng
          45.17210966999772,  # p2Lat
          1.009765625,  # p2Lng
          49.62625916704081,  # p3Lat
          4.6181640625,  # p3Lng
      ]

      results = index.search("query", {"insidePolygon": [polygon]})
      ```

      ```ruby Ruby theme={"system"}
      polygon = [
        # p1Lat
        46.650828100116044,
        # p1Lng
        7.123046875,
        # p2Lat
        45.17210966999772,
        # p2Lng
        1.009765625,
        # p3Lat
        49.62625916704081,
        # p3Lng
        4.6181640625
      ]

      results = index.search(
        "query",
        {
          insidePolygon: [polygon]
        }
      )
      ```

      ```scala Scala theme={"system"}
      client.execute {
        search into "myIndex" query Query(
          query = Some("query"),
          insidePolygon = Some(Seq(
            InsidePolygon(
              46.650828100116044,
              7.123046875,
              45.17210966999772,
              1.009765625,
              49.62625916704081,
              4.6181640625
            )
          ))
        )
      }
      ```

      ```swift Swift theme={"system"}
      let polygon = Polygon(
        (46.650828100116044, 7.123046875),
        (45.17210966999772, 1.009765625),
        (49.62625916704081, 4.6181640625),
        (47.715070300900194, 0.482421875)
      )

      let query = Query("query")
        .set(\.insidePolygon, to: [polygon])

      index.search(query: query) { result in
        if case .success(let response) = result {
          print("Response: \(response)")
        }
      }
      ```
    </CodeGroup>
  </Accordion>
</AccordionGroup>

### Search inside multiple polygons

<AccordionGroup>
  <Accordion title="Current API clients" defaultOpen>
    <CodeGroup>
      ```cs C# theme={"system"}
      var response = await client.SearchSingleIndexAsync<Hit>(
        "INDEX_NAME",
        new SearchParams(
          new SearchParamsObject
          {
            InsidePolygon = new List<List<Double>>
            {
              new List<Double>
              {
                42.01,
                -124.31,
                48.835509470063045,
                -124.40453125000005,
                45.01082951668149,
                -65.95726562500005,
                31.247243545293433,
                -81.06578125000004,
                25.924152577235226,
                -97.68234374999997,
                32.300311895879545,
                -117.54828125,
              },
            },
          }
        )
      );
      ```

      ```dart Dart theme={"system"}
      final response = await client.searchSingleIndex(
        indexName: "INDEX_NAME",
        searchParams: SearchParamsObject(
          insidePolygon: [
            [
              42.01,
              -124.31,
              48.835509470063045,
              -124.40453125000005,
              45.01082951668149,
              -65.95726562500005,
              31.247243545293433,
              -81.06578125000004,
              25.924152577235226,
              -97.68234374999997,
              32.300311895879545,
              -117.54828125,
            ],
          ],
        ),
      );
      ```

      ```go Go theme={"system"}
      response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(
        "INDEX_NAME").WithSearchParams(search.SearchParamsObjectAsSearchParams(
        search.NewEmptySearchParamsObject().SetInsidePolygon(
          [][]float64{
            {
              42.01,
              -124.31,
              48.835509470063045,
              -124.40453125000005,
              45.01082951668149,
              -65.95726562500005,
              31.247243545293433,
              -81.06578125000004,
              25.924152577235226,
              -97.68234374999997,
              32.300311895879545,
              -117.54828125,
            },
          }))))
      if err != nil {
        // handle the eventual error
        panic(err)
      }
      ```

      ```java Java theme={"system"}
      SearchResponse response = client.searchSingleIndex(
        "INDEX_NAME",
        new SearchParamsObject().setInsidePolygon(
          Arrays.asList(
            Arrays.asList(
              42.01,
              -124.31,
              48.835509470063045,
              -124.40453125000005,
              45.01082951668149,
              -65.95726562500005,
              31.247243545293433,
              -81.06578125000004,
              25.924152577235226,
              -97.68234374999997,
              32.300311895879545,
              -117.54828125
            )
          )
        ),
        Hit.class
      );
      ```

      ```js JavaScript theme={"system"}
      const response = await client.searchSingleIndex({
        indexName: 'indexName',
        searchParams: {
          insidePolygon: [
            [
              42.01, -124.31, 48.835509470063045, -124.40453125000005, 45.01082951668149, -65.95726562500005,
              31.247243545293433, -81.06578125000004, 25.924152577235226, -97.68234374999997, 32.300311895879545,
              -117.54828125,
            ],
          ],
        },
      });
      ```

      ```kotlin Kotlin theme={"system"}
      var response =
        client.searchSingleIndex(
          indexName = "INDEX_NAME",
          searchParams =
            SearchParamsObject(
              insidePolygon =
                listOf(
                  listOf(
                    42.01,
                    -124.31,
                    48.835509470063045,
                    -124.40453125000005,
                    45.01082951668149,
                    -65.95726562500005,
                    31.247243545293433,
                    -81.06578125000004,
                    25.924152577235226,
                    -97.68234374999997,
                    32.300311895879545,
                    -117.54828125,
                  )
                )
            ),
        )
      ```

      ```php PHP theme={"system"}
      $response = $client->searchSingleIndex(
          'INDEX_NAME',
          ['insidePolygon' => [
              [
                  42.01,

                  -124.31,

                  48.835509470063045,

                  -124.40453125000005,

                  45.01082951668149,

                  -65.95726562500005,

                  31.247243545293433,

                  -81.06578125000004,

                  25.924152577235226,

                  -97.68234374999997,

                  32.300311895879545,

                  -117.54828125,
              ],
          ],
          ],
      );
      ```

      ```python Python theme={"system"}
      response = client.search_single_index(
          index_name="INDEX_NAME",
          search_params={
              "insidePolygon": [
                  [
                      42.01,
                      -124.31,
                      48.835509470063045,
                      -124.40453125000005,
                      45.01082951668149,
                      -65.95726562500005,
                      31.247243545293433,
                      -81.06578125000004,
                      25.924152577235226,
                      -97.68234374999997,
                      32.300311895879545,
                      -117.54828125,
                  ],
              ],
          },
      )
      ```

      ```ruby Ruby theme={"system"}
      response = client.search_single_index(
        "INDEX_NAME",
        Algolia::Search::SearchParamsObject.new(
          inside_polygon: [
            [
              42.01,
              -124.31,
              48.835509470063045,
              -124.40453125000005,
              45.01082951668149,
              -65.95726562500005,
              31.247243545293433,
              -81.06578125000004,
              25.924152577235226,
              -97.68234374999997,
              32.300311895879545,
              -117.54828125
            ]
          ]
        )
      )
      ```

      ```scala Scala theme={"system"}
      val response = Await.result(
        client.searchSingleIndex(
          indexName = "INDEX_NAME",
          searchParams = Some(
            SearchParamsObject(
              insidePolygon = Some(
                Seq(
                  Seq(42.01, -124.31, 48.835509470063045, -124.40453125000005, 45.01082951668149, -65.95726562500005,
                    31.247243545293433, -81.06578125000004, 25.924152577235226, -97.68234374999997, 32.300311895879545,
                    -117.54828125)
                )
              )
            )
          )
        ),
        Duration(100, "sec")
      )
      ```

      ```swift Swift theme={"system"}
      let response: SearchResponse<Hit> = try await client.searchSingleIndex(
          indexName: "INDEX_NAME",
          searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(insidePolygon: [[
              42.01,
              -124.31,
              48.835509470063045,
              -124.40453125000005,
              45.01082951668149,
              -65.95726562500005,
              31.247243545293433,
              -81.06578125000004,
              25.924152577235226,
              -97.68234374999997,
              32.300311895879545,
              -117.54828125,
          ]]))
      )
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Legacy API clients">
    <CodeGroup>
      ```cs C# theme={"system"}
      index.Search(new Query("query")
      {
          InsidePolygon = new List>
          {
              new List
              {
                  46.650828100116044f,
                  7.123046875f,
                  45.17210966999772f,
                  1.009765625f,
                  49.62625916704081f,
                  4.6181640625f
              }
          }
      });
      ```

      ```go Go theme={"system"}
      res, err := index.Search(
      	"query",
      	opt.InsidePolygon([][]float64{
      		{
      			46.650828100116044, // p1Lat
      			7.123046875,        // p1Lng
      			45.17210966999772,  // p2Lat
      			1.009765625,        // p2Lng
      			49.62625916704081,  // p3Lat
      			4.6181640625,       // p3Lng
      		},
      	}),
      )
      ```

      ```java Java theme={"system"}
      index.search(
          new Query("query")
              .setInsidePolygon(
                  Arrays.asList(
                      Arrays.asList(
                          46.650828100116044f,
                          7.123046875f,
                          45.17210966999772f,
                          1.009765625f,
                          49.62625916704081f,
                          4.6181640625f))));
      ```

      ```js JavaScript theme={"system"}
      const polygon = [
        46.650828100116044, // p1Lat
        7.123046875, // p1Lng
        45.17210966999772, // p2Lat
        1.009765625, // p2Lng
        49.62625916704081, // p3Lat
        4.6181640625, // p3Lng
      ];

      index
        .search("query", {
          insidePolygon: [polygon],
        })
        .then(({ hits }) => {
          console.log(hits);
        });
      ```

      ```kotlin Kotlin theme={"system"}
      val query = query("query") {
          insidePolygon {
              +Polygon(
                  Point(latitude = 46.650828100116044f, longitude = 7.123046875f),
                  Point(latitude = 45.17210966999772f, longitude = 1.009765625f),
                  Point(latitude = 49.62625916704081f, longitude = 4.6181640625f)
              )
          }
      }

      index.search(query)
      ```

      ```php PHP theme={"system"}
      $polygon = [
        46.650828100116044, // p1Lat
        7.123046875, // p1Lng
        45.17210966999772, // p2Lat
        1.009765625, // p2Lng
        49.62625916704081, // p3Lat
        4.6181640625 // p3Lng
      ];

      $results = $index->search('query', [
        'insidePolygon' => [$polygon]
      ]);
      ```

      ```python Python theme={"system"}
      polygon = [
          46.650828100116044,  # p1Lat
          7.123046875,  # p1Lng
          45.17210966999772,  # p2Lat
          1.009765625,  # p2Lng
          49.62625916704081,  # p3Lat
          4.6181640625,  # p3Lng
      ]

      results = index.search("query", {"insidePolygon": [polygon]})
      ```

      ```ruby Ruby theme={"system"}
      polygon = [
        # p1Lat
        46.650828100116044,
        # p1Lng
        7.123046875,
        # p2Lat
        45.17210966999772,
        # p2Lng
        1.009765625,
        # p3Lat
        49.62625916704081,
        # p3Lng
        4.6181640625
      ]

      results = index.search(
        "query",
        {
          insidePolygon: [polygon]
        }
      )
      ```

      ```scala Scala theme={"system"}
      client.execute {
        search into "myIndex" query Query(
          query = Some("query"),
          insidePolygon = Some(Seq(
            InsidePolygon(
              46.650828100116044,
              7.123046875,
              45.17210966999772,
              1.009765625,
              49.62625916704081,
              4.6181640625
            )
          ))
        )
      }
      ```

      ```swift Swift theme={"system"}
      let polygon = Polygon(
        (46.650828100116044, 7.123046875),
        (45.17210966999772, 1.009765625),
        (49.62625916704081, 4.6181640625),
        (47.715070300900194, 0.482421875)
      )

      let query = Query("query")
        .set(\.insidePolygon, to: [polygon])

      index.search(query: query) { result in
        if case .success(let response) = result {
          print("Response: \(response)")
        }
      }
      ```
    </CodeGroup>
  </Accordion>
</AccordionGroup>

### Search inside multiple polygons

<AccordionGroup>
  <Accordion title="Current API clients" defaultOpen>
    <CodeGroup>
      ```cs C# theme={"system"}
      index.Search(new Query("query")
      {
          InsidePolygon = new List>
          {
              new List
              {
                  46.650828100116044f,
                  7.123046875f,
                  45.17210966999772f,
                  1.009765625f,
                  49.62625916704081f,
                  4.6181640625f
              },
              new List
              {
                  49.62625916704081f,
                  4.6181640625f,
                  47.715070300900194f,
                  0.482421875f,
                  45.17210966999772f,
                  1.009765625f,
                  50.62626704081f,
                  4.6181640625f
              }
          }
      });
      ```

      ```go Go theme={"system"}
      res, err := index.Search(
      	"query",
      	opt.InsidePolygon([][]float64{
      		{
      			46.650828100116044, // p1Lat
      			7.123046875,        // p1Lng
      			45.17210966999772,  // p2Lat
      			1.009765625,        // p2Lng
      			49.62625916704081,  // p3Lat
      			4.6181640625,       // p3Lng
      		},
      		{
      			49.62625916704081,  // p1Lat
      			4.6181640625,       // p1Lng
      			47.715070300900194, // p2Lat
      			0.482421875,        // p2Lng
      			45.17210966999772,  // p3Lat
      			1.009765625,        // p3Lng
      			50.62626704081,     // p4Lat
      			4.6181640625,       // p4Lng
      		},
      	}),
      )
      ```

      ```java Java theme={"system"}
      index.search(
          new Query("query")
              .setInsidePolygon(
                  Arrays.asList(
                      Arrays.asList(
                          46.650828100116044f,
                          7.123046875f,
                          45.17210966999772f,
                          1.009765625f,
                          49.62625916704081f,
                          4.6181640625f),
                      Arrays.asList(
                          49.62625916704081f,
                          4.6181640625f,
                          47.715070300900194f,
                          0.482421875f,
                          45.17210966999772f,
                          1.009765625f,
                          50.62626704081f,
                          4.6181640625f))));
      ```

      ```js JavaScript theme={"system"}
      const polygon1 = [
        46.650828100116044, // p1Lat
        7.123046875, // p1Lng
        45.17210966999772, // p2Lat
        1.009765625, // p2Lng
        49.62625916704081, // p3Lat
        4.6181640625 // p3Lng
      ];

      const polygon2 = [
        49.62625916704081, // p1Lat
        4.6181640625 // p1Lng
        47.715070300900194 // p2Lat
        0.482421875 // p2Lng
        45.17210966999772, // p3Lat
        1.009765625, // p3Lng
        50.62626704081, // p4Lat
        4.6181640625 // p4Lng
      ];

      index.search('query', {
        insidePolygon: [polygon1, polygon2]
      }).then(({ hits }) => {
        console.log(hits);
      });
      ```

      ```kotlin Kotlin theme={"system"}
      val query = query("query") {
          insidePolygon {
              +Polygon(
                  Point(latitude = 46.650828100116044f, longitude = 7.123046875f),
                  Point(latitude = 45.17210966999772f, longitude = 1.009765625f),
                  Point(latitude = 49.62625916704081f, longitude = 4.6181640625f)
              )
              +Polygon(
                  Point(latitude = 49.62625916704081f, longitude = 4.6181640625f),
                  Point(latitude = 47.715070300900194f, longitude = 0.482421875f),
                  Point(latitude = 45.17210966999772f, longitude = 1.009765625f),
                  Point(latitude = 50.62626704081f, longitude = 4.6181640625f)
              )
          }
      }

      index.search(query)
      ```

      ```php PHP theme={"system"}
      $polygon1 = [
        46.650828100116044, // p1Lat
        7.123046875, // p1Lng
        45.17210966999772, // p2Lat
        1.009765625, // p2Lng
        49.62625916704081, // p3Lat
        4.6181640625 // p3Lng
      ];

      $polygon2 = [
        49.62625916704081, // p1Lat
        4.6181640625 // p1Lng
        47.715070300900194 // p2Lat
        0.482421875 // p2Lng
        45.17210966999772, // p3Lat
        1.009765625, // p3Lng
        50.62626704081, // p4Lat
        4.6181640625 // p4Lng
      ];

      $results = $index->search('query', [
        'insidePolygon' => [
          $polygon1,
          $polygon2
        ]
      ]);
      ```

      ```python Python theme={"system"}
      polygon1 = [
          46.650828100116044,  # p1Lat
          7.123046875,  # p1Lng
          45.17210966999772,  # p2Lat
          1.009765625,  # p2Lng
          49.62625916704081,  # p3Lat
          4.6181640625,  # p3Lng
      ]

      polygon2 = [
          49.62625916704081,  # p1Lat
          4.6181640625,  # p1Lng
          47.715070300900194,  # p2Lat
          0.482421875,  # p2Lng
          45.17210966999772,  # p3Lat
          1.009765625,  # p3Lng
          50.62626704081,  # p4Lat
          4.6181640625,  # p4Lng
      ]

      results = index.search("query", {"insidePolygon": [polygon1, polygon2]})
      ```

      ```ruby Ruby theme={"system"}
      polygon1 = [
        46.650828100116044, # p1Lat
        7.123046875, # p1Lng
        45.17210966999772, # p2Lat
        1.009765625, # p2Lng
        49.62625916704081, # p3Lat
        4.6181640625 # p3Lng
      ]

      polygon2 = [
        49.62625916704081, # p1_lat
        4.6181640625 # p1Lng
        47.715070300900194 # p2Lat
        0.482421875 # p2Lng
        45.17210966999772, # p3Lat
        1.009765625, # p3Lng
        50.62626704081, # p4Lat
        4.6181640625 # p4Lng
      ]

      results = index.search('query', {
        insidePolygon: [polygon1, polygon2]
      })
      ```

      ```scala Scala theme={"system"}
      client.execute {
        search into "myIndex" query Query(
          query = Some("query"),
          insidePolygon = Some(Seq(
            InsidePolygon(
              46.650828100116044,
              7.123046875,
              45.17210966999772,
              1.009765625,
              49.62625916704081,
              4.6181640625
            ),
            InsidePolygon(
              49.62625916704081,
              4.6181640625,
              47.715070300900194,
              0.482421875,
              45.17210966999772,
              1.009765625,
              50.62626704081,
              4.6181640625
            )
          ))
        )
      }
      ```

      ```swift Swift theme={"system"}
      let polygon1 = Polygon(
        (46.650828100116044, 7.123046875),
        (45.17210966999772, 1.009765625),
        (49.62625916704081, 4.6181640625),
        (47.715070300900194, 0.482421875)
      )

      let polygon2 = Polygon(
        (47.650828100116044, 6.123046875),
        (46.17210966999772, 1.009765625),
        (48.62625916704081, 3.6181640625),
        (45.715070300900194, 0.482421875)
      )

      let query = Query("query")
        .set(\.insidePolygon, to: [
          polygon1,
          polygon2
        ])

      index.search(query: query) { result in
        if case .success(let response) = result {
          print("Response: \(response)")
        }
      }
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Legacy API clients">
    <CodeGroup>
      ```cs C# theme={"system"}
      index.Search(new Query("query")
      {
          InsidePolygon = new List>
          {
              new List
              {
                  46.650828100116044f,
                  7.123046875f,
                  45.17210966999772f,
                  1.009765625f,
                  49.62625916704081f,
                  4.6181640625f
              },
              new List
              {
                  49.62625916704081f,
                  4.6181640625f,
                  47.715070300900194f,
                  0.482421875f,
                  45.17210966999772f,
                  1.009765625f,
                  50.62626704081f,
                  4.6181640625f
              }
          }
      });
      ```

      ```go Go theme={"system"}
      res, err := index.Search(
      	"query",
      	opt.InsidePolygon([][]float64{
      		{
      			46.650828100116044, // p1Lat
      			7.123046875,        // p1Lng
      			45.17210966999772,  // p2Lat
      			1.009765625,        // p2Lng
      			49.62625916704081,  // p3Lat
      			4.6181640625,       // p3Lng
      		},
      		{
      			49.62625916704081,  // p1Lat
      			4.6181640625,       // p1Lng
      			47.715070300900194, // p2Lat
      			0.482421875,        // p2Lng
      			45.17210966999772,  // p3Lat
      			1.009765625,        // p3Lng
      			50.62626704081,     // p4Lat
      			4.6181640625,       // p4Lng
      		},
      	}),
      )
      ```

      ```java Java theme={"system"}
      index.search(
          new Query("query")
              .setInsidePolygon(
                  Arrays.asList(
                      Arrays.asList(
                          46.650828100116044f,
                          7.123046875f,
                          45.17210966999772f,
                          1.009765625f,
                          49.62625916704081f,
                          4.6181640625f),
                      Arrays.asList(
                          49.62625916704081f,
                          4.6181640625f,
                          47.715070300900194f,
                          0.482421875f,
                          45.17210966999772f,
                          1.009765625f,
                          50.62626704081f,
                          4.6181640625f))));
      ```

      ```js JavaScript theme={"system"}
      const polygon1 = [
        46.650828100116044, // p1Lat
        7.123046875, // p1Lng
        45.17210966999772, // p2Lat
        1.009765625, // p2Lng
        49.62625916704081, // p3Lat
        4.6181640625 // p3Lng
      ];

      const polygon2 = [
        49.62625916704081, // p1Lat
        4.6181640625 // p1Lng
        47.715070300900194 // p2Lat
        0.482421875 // p2Lng
        45.17210966999772, // p3Lat
        1.009765625, // p3Lng
        50.62626704081, // p4Lat
        4.6181640625 // p4Lng
      ];

      index.search('query', {
        insidePolygon: [polygon1, polygon2]
      }).then(({ hits }) => {
        console.log(hits);
      });
      ```

      ```kotlin Kotlin theme={"system"}
      val query = query("query") {
          insidePolygon {
              +Polygon(
                  Point(latitude = 46.650828100116044f, longitude = 7.123046875f),
                  Point(latitude = 45.17210966999772f, longitude = 1.009765625f),
                  Point(latitude = 49.62625916704081f, longitude = 4.6181640625f)
              )
              +Polygon(
                  Point(latitude = 49.62625916704081f, longitude = 4.6181640625f),
                  Point(latitude = 47.715070300900194f, longitude = 0.482421875f),
                  Point(latitude = 45.17210966999772f, longitude = 1.009765625f),
                  Point(latitude = 50.62626704081f, longitude = 4.6181640625f)
              )
          }
      }

      index.search(query)
      ```

      ```php PHP theme={"system"}
      $polygon1 = [
        46.650828100116044, // p1Lat
        7.123046875, // p1Lng
        45.17210966999772, // p2Lat
        1.009765625, // p2Lng
        49.62625916704081, // p3Lat
        4.6181640625 // p3Lng
      ];

      $polygon2 = [
        49.62625916704081, // p1Lat
        4.6181640625 // p1Lng
        47.715070300900194 // p2Lat
        0.482421875 // p2Lng
        45.17210966999772, // p3Lat
        1.009765625, // p3Lng
        50.62626704081, // p4Lat
        4.6181640625 // p4Lng
      ];

      $results = $index->search('query', [
        'insidePolygon' => [
          $polygon1,
          $polygon2
        ]
      ]);
      ```

      ```python Python theme={"system"}
      polygon1 = [
          46.650828100116044,  # p1Lat
          7.123046875,  # p1Lng
          45.17210966999772,  # p2Lat
          1.009765625,  # p2Lng
          49.62625916704081,  # p3Lat
          4.6181640625,  # p3Lng
      ]

      polygon2 = [
          49.62625916704081,  # p1Lat
          4.6181640625,  # p1Lng
          47.715070300900194,  # p2Lat
          0.482421875,  # p2Lng
          45.17210966999772,  # p3Lat
          1.009765625,  # p3Lng
          50.62626704081,  # p4Lat
          4.6181640625,  # p4Lng
      ]

      results = index.search("query", {"insidePolygon": [polygon1, polygon2]})
      ```

      ```ruby Ruby theme={"system"}
      polygon1 = [
        46.650828100116044, # p1Lat
        7.123046875, # p1Lng
        45.17210966999772, # p2Lat
        1.009765625, # p2Lng
        49.62625916704081, # p3Lat
        4.6181640625 # p3Lng
      ]

      polygon2 = [
        49.62625916704081, # p1_lat
        4.6181640625 # p1Lng
        47.715070300900194 # p2Lat
        0.482421875 # p2Lng
        45.17210966999772, # p3Lat
        1.009765625, # p3Lng
        50.62626704081, # p4Lat
        4.6181640625 # p4Lng
      ]

      results = index.search('query', {
        insidePolygon: [polygon1, polygon2]
      })
      ```

      ```scala Scala theme={"system"}
      client.execute {
        search into "myIndex" query Query(
          query = Some("query"),
          insidePolygon = Some(Seq(
            InsidePolygon(
              46.650828100116044,
              7.123046875,
              45.17210966999772,
              1.009765625,
              49.62625916704081,
              4.6181640625
            ),
            InsidePolygon(
              49.62625916704081,
              4.6181640625,
              47.715070300900194,
              0.482421875,
              45.17210966999772,
              1.009765625,
              50.62626704081,
              4.6181640625
            )
          ))
        )
      }
      ```

      ```swift Swift theme={"system"}
      let polygon1 = Polygon(
        (46.650828100116044, 7.123046875),
        (45.17210966999772, 1.009765625),
        (49.62625916704081, 4.6181640625),
        (47.715070300900194, 0.482421875)
      )

      let polygon2 = Polygon(
        (47.650828100116044, 6.123046875),
        (46.17210966999772, 1.009765625),
        (48.62625916704081, 3.6181640625),
        (45.715070300900194, 0.482421875)
      )

      let query = Query("query")
        .set(\.insidePolygon, to: [
          polygon1,
          polygon2
        ])

      index.search(query: query) { result in
        if case .success(let response) = result {
          print("Response: \(response)")
        }
      }
      ```
    </CodeGroup>
  </Accordion>
</AccordionGroup>
