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

# Search in Bigdata

Easily find the most relevant information from trusted sources and your own data. Use it to power agents that give accurate, real-time answers.

**Ready to start using the Search Service? Let's dive in!**

<Tabs>
  <Tab title="API">
    We will create a sample API request and describe the main request parameters. The best way to try it out is the [Developer Platform > Search Playground](https://platform.bigdata.com/playground/search/search)

    The `query` request object contains the following main parameters:

    * `text`: Natural-language search string equivalent to the Similarity filter in the SDK. It is not mandatory when filtering by entities, keywords or other filters.
    * `filters`: It supports equivalent filters as the SDK described in [Query Filters](./query_filters). For instance: `timestamp`, `entity`, `keyword`, `source`, `topic`, `sentiment`, `reporting_entity`, etc
    * `external_search` (optional): Include **live web results** alongside premium content. Set `mode` (`INCLUDE` or `ONLY`) and `values` (e.g. `["web"]`). For web search, only `query.text` is used; any other query parameters apply only to Bigdata content. See [Search documents](/api-reference/search/search-documents#body-query-external-search).
    * `ranking_params`: Allow customers to control the search ranking algorithm. The Re-ranker is set by default with a threshold between 0.2 and 0.3 depending of the applied filters.
    * `max_chunks` Maximum number of chunks to retrieve. It must be lower than or equal to 1000. The response might contain a lower number of chunks due to discarding duplicated chunks after the matching phase.

    The following example searches for news about Pfizer's partnerships and returns ten chunks.

    ```bash theme={null}
    curl -X POST 'https://api.bigdata.com/v1/search' \
      -H 'Content-Type: application/json' \
      -H 'X-API-KEY: <your-api-key>' \
      --data '{
      "search_mode": "fast",
      "query": {
        "text": "Partnership",
        "filters": {
          "timestamp": {
            "start": "2025-07-16T22:00:00.000Z",
            "end": "2025-10-14T21:59:59.999Z"
          },
          "entity": {
            "any_of": [
              "267718"
            ]
          }
        },
        "external_search": {
          "mode": "INCLUDE",
          "values": ["web"]
        },
        "ranking_params": {
          "source_boost": 10,
          "freshness_boost": 1
        },
        "max_chunks": 10
      }
    }'
    ```

    Output:

    The response contains an array of documents with the text chunks that matched the query criteria.

    ```json theme={null}
    {
        "results": [
            {
                "id": "62433E4658007ECAD1929C7AF495A658",
                "headline": "Pfizer Deal; Oracle Rising on TikTok News; Alphabet and DOJ",
                "timestamp": "2025-09-22T13:24:08",
                "source": {
                    "id": "5E6268",
                    "name": "Stock Movers",
                    "rank": "RANK_1"
                },
                "url": "https://podtrac.com/pts/redirect.mp3/traffic.omny.fm/d/clips/e73c998e-6e60-432f-8610-ae210140c5b1/deb345cd-6d73-4a24-a6e3-b2a50138dd86/5ab1a963-8b0b-4743-ab3d-b36000da62b9/audio.mp3?utm_source=Podcast&in_playlist=a55c6f22-aa32-4a58-aebd-b2a50138e2b2",
                "chunks": [
                    {
                        "cnum": 2,
                        "text": "On this episode of Stock Movers:- Pfizer (PFE) 
                        is moving as it agreed to buy the obesity startup Metsera Inc. 
                        for an enterprise value of about $4.9 billion to bolster its 
                        pipeline after a key weight-loss pill foundered. The US 
                        drugmaker will pay Metsera $47.50 in cash per share, and further 
                        payments of up to $22.50 per share if three specific 
                        and regulatory milestones are met, it said in a statement Monday.
                        The deal represents a 43% premium to Metsera's closing
                        share price on Friday. Oracle (ORCL) is rising his morning on news would recreate and provide security for a new US version of TikTok's algorithm under a deal to sell the app to a consortium of American investors. Oracle will operate in partnership with the US government on everything from algorithm retraining to application development and source code review to ensure content is free from improper manipulation or surveillance. Alphabet (GOOG) shareholders are following news that the Justice Department is heading to court to force a breakup of Alphabet's Google, seeking to divest its advertising exchange AdX, which the department says is the best way to restore competition in the market for online display advertising.",
                        "relevance": 0.38801944336096794,
                        "sentiment": -0.63
                    }
                ]
            },
            ... // more documents
        ],
        "metadata": {
            "request_id": "8bd31f92-ca62-4b88-a542-a1394c881eba",
            "timestamp": "2025-10-16T14:50:49.013579+00:00"
        },
        "external_results": {
            "web": [
              {
                "headline": "What is Partnership? Definition, Types & Features in Business",
                "timestamp": "2025-07-28T00:00:00+00:00",
                "chunks": [
                  {
                    "cnum": 1,
                    "text": "A partnership is a business where two or more people work together and share profits. Each partner contributes skills, money, or effort as per their agreement to run the business. What is a Partnership? A partnership is when two or more people run and share a business together. They split responsibilities, profits, and losses based on a mutual legal agreement. What Are The Key Characteristics of a Partnership? A partnership is built on mutual understanding, trust, and shared responsibility.",
                    "relevance": 0.99987566,
                    "rerank_relevance": 0.99987566
                  },
                  {
                    "cnum": 4,
                    "text": "The table below highlights the key advantages of partnerships. What Are The Disadvantages of Partnership? While partnerships offer many benefits, they also come with certain risks and limitations. The table below outlines some common disadvantages of partnerships. A partnership is an easy way to start a business with someone you trust. You both share the money, work, ideas, and profits. There are different types, and each has its own rules. It’s simple to start and manage, but it has some risks too. With a clear agreement and good talk, it can be a great way to work together. Q1: What are the three elements of a partnership? A partnership must involve doing business together, jointly, with the goal of making a profit. LLP? LLP (Limited Liability Partnership) is a business structure where partners share profits but have limited personal liability for business debts.",
                    "relevance": 0.9961903,
                    "rerank_relevance": 0.9961903
                  }
                ],
                "src_name": "www.loansjagat.com",
                "url": "https://www.loansjagat.com/blog/what-is-partnership"
              },
              ... // more results
              ]
        },
        "usage": {
            "api_query_units": 1.0
        }
    }
    ```

    <Tip>
      The quickest way to test the Search Service is with the [Search Playgrounds](https://platform.bigdata.com/search). It contains a playground per Search Service endpoint.

      * The most popular is the [Search documents playground](https://platform.bigdata.com/search/search-documents).

      These documentation pages also contain examples:

      * [Co-mentions](./search_co_mentions): to see which entities, topics, and sources appear most in your results.
      * [Search Volume](../../how-to-guides/search/search-volume): to retrieve document and chunk volume statistics over time for a search query, aggregated by date with sentiment analysis.
    </Tip>

    <Tip>
      Need to process large volumes? [Batch Search](/api-reference/batch-search/create-a-batch-job) lets you run many requests at once with 50% lower costs.
    </Tip>
  </Tab>

  <Tab title="Python SDK">
    <Warning>
      We advise new users to integrate directly with our API rather than using the SDK, as it provides the latest features.
    </Warning>

    We will create a query with a criteria to find insights and then create and run the search.

    Search parameters:

    * `query`: A query object that represents the search criteria. It can
      contain several query filters combined with standard operators. More details in [Query Filters](./query_filters)
    * `rerank_threshold` (Optional): A float between 0 and 1 for an optional re-ranking phase. More details in [Rerank search](../../how-to-guides/rerank_search)
    * `scope` (Optional): An object that filters the search results by content
      type (news, files, etc.). More details in [Scope](./scope).
    * `date_range` (Optional): A date range object that specifies the time frame of the
      search. More details in [Date Range](./date_range).
    * `sortby` (Optional): An enum that specifies the sorting criteria of the search
      results, either by `SortBy.DATE` or `SortBy.RELEVANCE`.

    Example:

    The following example searches for news about Pfizer's partnerships and returns one document.

    ```python highlight={8-15} theme={null}
    from bigdata_client.query import Entity
    from bigdata_client.query import Similarity
    from bigdata_client.daterange import RollingDateRange

    # Find Pfizer ID
    pfizer_id = bigdata.knowledge_graph.find_companies("Pfizer")[0].id

    # Craft the query: Partnership news where Pfizer has been identified
    query = Similarity("Partnership") & Entity(pfizer_id)

    # Create the search
    search = bigdata.search.new(query, rerank_threshold=0.2, date_range=RollingDateRange.LAST_NINETY_DAYS)

    # Run the search to retrieve one document and print an overview of the document
    documents = search.run(1) 

    # Loop through the list of retrieved documents
    for doc in documents:
        print(doc)
    ```

    Output:

    ```console theme={null}
    Document ID:        EB961CB16ECEDF294F77AB943DE144B6
    Timestamp:                       2025-07-10 09:43:35
    Scope:                                          News
    Source (Rank):                    Industry Today (3)
    Title: Biosimilars Partnering Market to Reach USD 24.5 Billion by 2032, Expanding at 12.5% CAGR
    Document Url: https://industrytoday.co.uk/health_and_safety/biosimilars-partnering-market-to-reach-usd-245-billion-by-2032-expanding-at-125-cagr
    Language:                                    English
    Sentiment:                                      0.57
    ====Sentence matches====
    *A B2B Market Fueled by Strategic Collaboration
    Biosimilars-highly similar, cost-effective alternatives to original biologic therapies-have become the cornerstone of next-generation therapeutic strategies. In the Biosimilars Partnering Market, business-to-business (B2B) collaboration is the foundation of success. Leading pharmaceutical and biotech companies such as Pfizer, Sandoz, Amgen, and Biocon are forming partnerships to leverage each other's R&D capabilities, manufacturing strengths, and global distribution networks. These strategic alliances are not only helping to reduce development costs but also facilitating faster market entry.
    --
    *India and South Korea, in particular, are becoming biotech innovation hubs, attracting collaborations from global pharmaceutical leaders. Meanwhile, Latin America and the Middle East & Africa (MEA) regions are slowly entering the landscape, driven by efforts to improve drug affordability and healthcare access.
    Competitive Landscape: Major Players Shaping the Future
    The market's competitive landscape is dominated by key players including Sandoz, Pfizer, Merck, Roche, Celltrion, Samsung Bioepis, Biocon, and Amgen. These companies are investing heavily in strategic partnerships to streamline biosimilar development and distribution.
    --
    ```

    <Note>
      The method `search.run(x)` requests `x` documents with chunks. Suppose you prefer to control the number of retrieved chunks instead of documents. You can use the object `ChunkLimit(y)`. Check out [Retrieved limited chunks](../../how-to-guides/queries_with_chunk_limit) for more details.
    </Note>
  </Tab>
</Tabs>
