vertex-ai-search

gettting 404 method not found when using rest API to create enterprise search dataStore, is it broken?


not sure where else to turn to here. Trying to use rest API to create a dataStore for a Vertex AI Search app(a.k.a Google Enterprise Search / Generative AI App Builder).

I have followed the documentation here https://cloud.google.com/generative-ai-app-builder/docs/create-data-store-es to try create a dataStore and ingest unstructured data from Cloud Storage.

The authentication is not an issue.

According to the docs here https://cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1alpha/projects.locations.collections.dataStores/create it is a valid method so i'm unsure why im getting a 404 method not found response. Ideally i would have used PHP library but its not supported at the moment so im forced to use REST.

Here is the code I am using if that helps:

$url = 'https://discoveryengine.googleapis.com/v1alpha/projects/xxxxxx/locations/global/collections/default_collection/dataStores?dataStoreId=xxxxxx';

$data = [
    'name' => 'xxxxxx',
    'displayName' => 'xxxxxx',
    'industryVertical' => 'GENERIC',
    'solutionTypes' => ['SOLUTION_TYPE_SEARCH'],
    'contentConfig' => 'CONTENT_REQUIRED',
    'searchTier' => 'ENTERPRISE',
    'searchAddOns' => ['LLM'],
    'companyInfo' => [
        'displayName' => 'xxxxxx'
    ]
];

$headers = [
    'Authorization: Bearer xxxxxx',
    'Content-Type: application/json',
    'X-Goog-User-Project: xxxxxx'
];

// Initialize cURL session
$ch = curl_init();

// Set cURL options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute the cURL request
$response = curl_exec($ch);

// Check for errors
if (curl_errno($ch)) {
    echo 'cURL Error: ' . curl_error($ch);
}

// Close cURL session
curl_close($ch);

I was expecting this request to create a dataStore for a Vertex AI Search App


Solution

  • Currently, you will need to create data stores/search engines through the Cloud Console instead of the REST API or Client Libraries. The documentation will been updated soon to specify this. This page shows how to create a data store using the Cloud Console and Import Data using the REST API or client libraries.

    https://cloud.google.com/generative-ai-app-builder/docs/create-data-store-es