---
title: "P075 Search the patent nested version with a search formula"
method: POST
path: "/search/patent/nested-search-patent"
tags: ["Patent Data Search"]
---

# P075 Search the patent nested version with a search formula

`POST /search/patent/nested-search-patent`

## Request

- Base URL: `https://connect.patsnap.com`
- URL: `https://connect.patsnap.com/search/patent/nested-search-patent`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/patsnap/apis/patsnap-open-platform-api/docs/search/patent/nested-search-patent/post.ts> (a function with typed inputs; its response is checked against the schema)

Search PatSnap's global patent database using standard text queries. Read about the search syntax supported in PatSnap here - https://analytics.patsnap.com/search_helper. This includes patent count, patent number, and patent ID.

## Request body

- P075PatentNestedSearchRequest
  - `facet` P075PatentNestedSearchFacet[]: <p>Nested statistical configuration</p><p>Supports four types:</p><p>field - Field statistics</p><p>range - Range statistics</p><p>query - Query statistics</p><p>aggregate - Aggregate statistics</p><p>1. field (Field statistics)</p><p><code>{ "type": "field", "tag": "patent_type", "field": "PATENT_TYPE", "limit": 10, "mincount": 1, "offset": 0, "num_buckets": true}</code></p><p>2. range (Range statistics)</p><p><code>{ "type": "range", "tag": "apd_year", "field": "APD_YEAR", "start": 2000, "end": 2018, "gap": 1}</code></p><p>3. query (Query statistics)</p><p><code>{ "type": "query", "tag": "patent_type", "query": "PV:[0 TO 100000]"}</code></p><p>4. aggregate (Aggregate statistics)</p><p><code>{ "type": "aggregate", "tag": "avg_pv", "expr": "avg(PV)" }</code></p>
    - `end` integer: Range end value (not included) (when type is range)
    - `expr` string: aggregate expressions support nesting. aggregate function currently supports five types: avg/min/max/sum/unique (when type is query)
    - `facet` unknown[]: Nested statistical configuration
      - unknown
    - `field` string: The name of the field to be counted (when type is field and range). Refer to : https://analytics.patsnap.com/search_helper
    - `gap` integer: Range step value, default is 1 (when type is range)
    - `limit` integer: How many statistical results need to be returned (when type is field)
    - `mincount` integer: The minimum value that can be returned for statistics is set to 1 by default (when type is field)
    - `num_buckets` boolean: Count number of buckets for the facet, which defaults to false. The returned format is tag_num_buckets (when type is field)
    - `offset` integer: The offset of the statistics, used for pagination, is set to 0 by default (when type is field)
    - `query` string: Queries that need to be statistically analyzed (when type is query)
    - `start` integer: Range starting value (when type is range)
    - `tag` string, required: The current statistics of custom aliases (alias names cannot be name or count)
    - `type` string, required: <p>Retrieval statistical type:</p><p> field - Statistics of field values, equivalent to the traditional facet field</p><p> range - range statistics for numerical fields will be automatically completed, equivalent to the traditional range facet</p><p> query - Statistics on query, equivalent to the traditional facet query</p><p> aggregate - Perform statistics such as min/max/sum on fields</p>
  - `limit` integer: Return the number of documents.
  - `offset` integer: offset
  - `query_text` string, required: Search expression text. Refer to : https://analytics.patsnap.com/search_helper
  - `sort` P075PatentNestedSearchSort[]: sort
    - `field` string: sort field
    - `order` string: sort order
  - `stemming` boolean: Whether to enable word segmentation, after enabling it, support the same stem query (for example: "cars" can be searched by "car"). By default, it is not enabled. Currently, only fields related to TTL/ABST/CLMS/DESC are supported

## Response `200`

Successful p075 search the patent nested version with a search formula response.

- P075PatentNestedSearchResponse
  - `data` P075PatentNestedSearchPatentNestedSearchResponse
    - `facets` object: statistical result（Dynamic key, defined based on the tag in the input parameter）
    - `num_found` integer: Total search result count
    - `id_mapping` object: When ANS is triggered, ANS information will be returned.
  - `status` boolean, required: Status
  - `error_msg` string: Error Message
  - `error_code` integer, required: Error Code

## Other responses

- `201`: Created.
- `401`: Unauthorized.
- `403`: Forbidden.
- `404`: Not Found.

---

[API](https://skmtc.dev/patsnap/apis/patsnap-open-platform-api.md) - [All operations](https://skmtc.dev/patsnap/apis/patsnap-open-platform-api/llms.txt) - [OpenAPI document](https://skmtc.dev/patsnap/apis/patsnap-open-platform-api/revisions/c2264a0de595?raw)
