Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Introducción a la búsqueda en BigQuery
Los índices de búsqueda de BigQuery te permiten usar GoogleSQL para
encontrar de forma eficiente
elementos de datos únicos pedidos en el texto no estructurado y en datos JSON
semiestructurados, sin tener que conocer los esquemas de tabla con anticipación.
Con los índices de búsqueda, BigQuery proporciona una potente tienda de columnas y una búsqueda de texto en una plataforma, lo que permite realizar búsquedas en filas eficientes cuando necesitas encontrar filas de datos individuales. Un caso de uso común es el análisis de registros. Por ejemplo, es posible que desees identificar las filas de datos asociadas con un usuario para los informes del Reglamento General de Protección de Datos (GDPR) o encontrar códigos de error específicos en una carga útil de texto.
BigQuery almacena y administra tus índices, de modo que, cuando los datos están
disponibles en BigQuery, puedes recuperarlos de inmediato con la
función SEARCH
o con otros operadores y funciones,
como los operadores igual (=), IN o LIKEy ciertas funciones de cadena
y JSON. Para optimizar tus búsquedas, consulta las
prácticas recomendadas.
Casos de uso
Los índices de búsqueda de BigQuery te ayudan a realizar las siguientes tareas:
Busca los registros del sistema, red o aplicaciones almacenados en tablas de BigQuery.
Identificar los elementos de datos que se deben borrar para cumplir con los procesos regulatorios.
Respalda la solución de problemas de los desarrolladores.
Realiza auditorías de seguridad.
Crea un panel que requiera filtros de búsqueda altamente selectivos.
Busca datos procesados con anterioridad para coincidencias exactas.
No se aplican cargos por el procesamiento necesario para compilar y actualizar los índices de búsqueda cuando el tamaño total de las tablas indexadas en tu organización está por debajo del límite de tu región. A fin de admitir la indexación más allá de este límite, debes proporcionar tu propia reserva para controlar los trabajos de administración de índices.
Los índices de búsqueda generan costos de almacenamiento cuando están activos.
Puedes encontrar el tamaño del almacenamiento de índices en la vista INFORMATION_SCHEMA.SEARCH_INDEXES.
Funciones y permisos
Para crear un índice de búsqueda, necesitas el permiso de IAM bigquery.tables.createIndex en la tabla en la que creas el índice. Para descartar un índice de búsqueda, necesitas el permiso bigquery.tables.deleteIndex. Cada uno de los siguientes roles predefinidos de IAM incluye los permisos que necesitas para trabajar con índices de búsqueda:
Propietario de datos de BigQuery (roles/bigquery.dataOwner)
Editor de datos de BigQuery (roles/bigquery.dataEditor)
BigQuery Admin (roles/bigquery.admin)
Limitaciones
No puedes crear un índice de búsqueda directamente en una vista o una vista materializada, pero si llamas a la función SEARCH en una vista de una tabla indexada, se usará el índice de búsqueda subyacente.
Si cambias el nombre de una tabla después de crear un índice de búsqueda, el índice deja de ser válido.
La función SEARCH está diseñada para las búsquedas de puntos. La búsqueda parcial, la corrección de tipografía, los comodines y otros tipos de búsquedas de documentos no están disponibles.
Si el índice de búsqueda aún no tiene una cobertura del 100%, se te cobra por todo el almacenamiento de índices que se informa en la vista INFORMATION_SCHEMA.SEARCH_INDEXES.
BigQuery BI Engine no acelera las consultas que contienen la función SEARCH.
Los índices de búsqueda no se usan cuando una declaración DML
modifica la tabla indexada, pero sí se pueden usar cuando el predicado que se puede optimizar con los
índices de búsqueda forma parte de una subconsulta en una declaración DML.
No se usa un índice de búsqueda en la siguiente consulta:
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-04-14 (UTC)"],[[["\u003cp\u003eBigQuery search indexes enable efficient searching of unstructured text and semi-structured JSON data using GoogleSQL, even without prior knowledge of table schemas.\u003c/p\u003e\n"],["\u003cp\u003eThese indexes facilitate row lookups, making them useful for tasks such as log analytics, GDPR compliance, and identifying specific error codes.\u003c/p\u003e\n"],["\u003cp\u003eBigQuery manages the indexes, allowing for immediate data retrieval through the \u003ccode\u003eSEARCH\u003c/code\u003e function and other operators like \u003ccode\u003e=\u003c/code\u003e, \u003ccode\u003eIN\u003c/code\u003e, or \u003ccode\u003eLIKE\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eUsing search indexes for indexed tables below a certain size limit in your region incurs no processing costs for building or refreshing the index, however storage costs for active indexes do apply.\u003c/p\u003e\n"],["\u003cp\u003eSearch indexes have limitations, they cannot be directly applied to views or materialized views, they do not allow fuzzy searching or typo correction, and aren't utilized during DML statements on the indexed table itself, among other limitations.\u003c/p\u003e\n"]]],[],null,["# Introduction to search in BigQuery\n==================================\n\n| **Note:** This feature may not be available when using reservations that are created with certain BigQuery editions. For more information about which features are enabled in each edition, see [Introduction to\n| BigQuery editions](/bigquery/docs/editions-intro).\n\nBigQuery search indexes let you use GoogleSQL to\nefficiently find\nunique data elements that are buried in unstructured text and semi-structured\nJSON data, without having to know the table schemas in advance.\n\nWith search indexes, BigQuery provides a powerful columnar store\nand text search in one platform, enabling efficient row lookups when you need to\nfind individual rows of data. A common use case is log analytics. For example,\nyou might want to identify the rows of data associated with a user for General\nData Protection Regulation (GDPR) reporting, or to find specific error codes in\na text payload.\n\nBigQuery stores and manages your indexes, so that when data becomes\navailable in BigQuery, you can immediately retrieve it with the\n[`SEARCH` function](/bigquery/docs/reference/standard-sql/search_functions#search)\nor [other operators and functions](/bigquery/docs/search#operator_and_function_optimization),\nsuch as the equal (`=`), `IN`, or `LIKE` operators and certain string and JSON\nfunctions. To optimize your searches, read about\n[best practices](/bigquery/docs/search#best_practices).\n| **Important:** Join the [Search discussion group](https://groups.google.com/g/bq-search) to post questions and comments, and to follow the latest updates.\n\nUse cases\n---------\n\nBigQuery search indexes help you perform the following tasks:\n\n- Search system, network, or application logs stored in BigQuery tables.\n- Identify data elements for deletion to comply with regulatory processes.\n- Support developer troubleshooting.\n- Perform security audits.\n- Create a dashboard that requires highly selective search filters.\n- Search pre-processed data for exact matches.\n\nFor more information, see\n[Create a search index](/bigquery/docs/search-index) and\n[Search with an index](/bigquery/docs/search).\n\nPricing\n-------\n\nThere is no charge for the processing required to build and refresh your search\nindexes when the total size of indexed tables in your organization is below\nyour region's\n[limit](/bigquery/quotas#index_limits). To support indexing beyond this limit,\nyou need to\n[provide your own reservation](/bigquery/docs/search-index#use_your_own_reservation)\nfor handling the index-management jobs.\nSearch indexes incur storage costs when they are active.\nYou can find the index storage size in the\n[`INFORMATION_SCHEMA.SEARCH_INDEXES` view](/bigquery/docs/information-schema-indexes).\n\nRoles and permissions\n---------------------\n\nTo create a search index, you need the\n[`bigquery.tables.createIndex` IAM permission](/bigquery/docs/access-control#bq-permissions)\non the table where you're creating the index. To drop a search index, you need\nthe `bigquery.tables.deleteIndex` permission. Each of the following predefined\nIAM roles includes the permissions that you need to work with\nsearch indexes:\n\n- BigQuery Data Owner (`roles/bigquery.dataOwner`)\n- BigQuery Data Editor (`roles/bigquery.dataEditor`)\n- BigQuery Admin (`roles/bigquery.admin`)\n\nLimitations\n-----------\n\n- You can't create a search index directly on a view or materialized view, but calling the [`SEARCH` function](/bigquery/docs/reference/standard-sql/search_functions#search) on a view of an indexed table makes use of the underlying search index.\n- You can't create a search index on an external table.\n- If you rename a table after you create a search index on it, the index becomes invalid.\n- The `SEARCH` function is designed for point lookups. Fuzzy searching, typo correction, wildcards, and other types of document searches are not available.\n- If the search index is not yet at 100% coverage, you are still charged for all index storage that is reported in the [`INFORMATION_SCHEMA.SEARCH_INDEXES` view](/bigquery/docs/information-schema-indexes).\n- Queries that use the `SEARCH` function or are optimized by search indexes are not accelerated by [BigQuery BI Engine](/bigquery/docs/bi-engine-intro).\n- Search indexes are not used when the indexed table is modified by a DML\n statement, but they can be used when the predicate that is optimizable by\n search indexes is part of a subquery in a DML statement.\n\n - A search index is not used in the following query:\n\n ```googlesql\n DELETE FROM my_dataset.indexed_table\n WHERE SEARCH(user_id, '123');\n ```\n - A search index can be used in the following query:\n\n ```googlesql\n DELETE FROM my_dataset.other_table\n WHERE\n user_id IN (\n SELECT user_id\n FROM my_dataset.indexed_table\n WHERE SEARCH(user_id, '123')\n );\n ```\n- Search indexes are not used when the query references [Materialized Views](/bigquery/docs/materialized-views-intro).\n\n- Search indexes are not used in a [multi-statement transaction query](/bigquery/docs/transactions).\n\n- Search indexes are not used in a [time-travel query](/bigquery/docs/time-travel).\n\nWhat's next\n-----------\n\n- Learn more about [creating a search index](/bigquery/docs/search-index).\n- Learn more about [searching in a table with a search index](/bigquery/docs/search)."]]