Sunday, May 5, 2024
No menu items!
HomeCloud ComputingWhat’s new with Firestore at Next ‘24

What’s new with Firestore at Next ‘24

Developers love Firestore because of how fast they can build applications and services end to end. As of today, Firestore has more than 500,000 monthly active developers, and Firestore apps power more than 1.3 billion monthly active end users using Firebase Auth. Recently, we’ve made updates to Firestore to improve developer productivity, enable developers to build the next generation AI-enabled applications, express richer queries, and help ensure that Firestore databases meet enterprises’ ever-growing needs.

Using Gemini to build applications with Firestore

We’re excited to share that Gemini Code Assist now incorporates assistive capabilities for developing with Firestore. Using Gemini Code Assist, along with your favorite Integrated Development Environment (IDE), you can use natural language to define your Firestore data models and write queries. For example, you can express queries using natural language statements like “get products from Firestore inventory collection” and translate that into Firestore SDK code in your favorite programming language:

Use natural language to write a Firestore query with Gemini Code Assist

To get started, refer to the Gemini Code Assist documentation to install the plugin for your favorite IDE, including Visual Studio Code, IntelliJ or Cloud Code.

You can also use Gemini to generate solution architectures and provision Firestore resources. Simply use the Gemini in Cloud Run application canvas in private preview, and type in a prompt like “LangChain app with Firestore and Vertex.”

Use natural language using Gemini in Cloud Run application canvas, to generate a solution architecture that includes Firestore

You can learn more about the Gemini in Cloud Run application canvas here.

Build next-gen AI-enabled applications

If you’re trying to build AI-enabled solutions such as a chatbot or recommendations engine, Firestore has you covered. Firestore now has built-in support for vector search using exact nearest neighbors, the ability to automatically generate vector embeddings using popular embedding models via a turn-key extension, and integrations with popular generative AI libraries such as LangChain and LlamaIndex.

Here’s an example of using Firestore’s vector search capabilities:

code_block
<ListValue: [StructValue([(‘code’, ‘collection_ref = collection(‘beans’)rncollection_refrn.where(“type”, “==”, “arabica”)rn.find_nearest(rn vector_field=”embedding_field”,rn query_vector=Vector([0.1, 0.2, …, 1]),rn distance_measure=DistanceMeasure.COSINE,rn limit=5)’), (‘language’, ‘lang-py’), (‘caption’, <wagtail.rich_text.RichText object at 0x3e64981918e0>)])]>

To get started, refer to the Firestore Vector Search documentation, Firestore Vector Search extension to generate embeddings documentation and documentation for Firestore’s LangChain and LlamaIndex integrations.

Express richer queries

Often applications require the ability to express queries that filter on range conditions across multiple fields. For example, if you run an e-commerce site, an end user might want to filter based on a t-shirt size and price ranges.

With the recent launch of queries using range filters on multiple fields in preview, you can easily and cost-efficiently perform these queries directly in Firestore.

code_block
<ListValue: [StructValue([(‘code’, ‘db.collection(“products”)rn .whereGreaterThanOrEqualTo(“price”, 100)rn .whereGreaterThanOrEqualTo(“rating”, 4);’), (‘language’, ‘lang-py’), (‘caption’, <wagtail.rich_text.RichText object at 0x3e6498191d30>)])]>

To get started, refer to the multiple range queries documentation.

We’re also introducing Firestore Query Explain in preview to help you troubleshoot your queries. You can run Explain to retrieve the proposed query plan, or optionally indicate that you’d like to execute the query and analyze the performance, billing and retrieve the actual query results using a special analyze flag:

code_block
<ListValue: [StructValue([(‘code’, ‘Query query = db.collection(“products”)rn .whereGreaterThanOrEqualTo(“price”, 100)rn .whereGreaterThanOrEqualTo(“rating”, 4);rnrnExplainResults<QuerySnapshot> explainResults = query.explain(ExplainOptions.builder().analyze(true).build());rnrnExplainMetrics metrics = explainResults.getMetrics();rnrnSystem.out.println(metrics.getExecutionStats());’), (‘language’, ‘lang-py’), (‘caption’, <wagtail.rich_text.RichText object at 0x3e64981919a0>)])]>

Here’s the output:

code_block
<ListValue: [StructValue([(‘code’, ‘{rn “executionStats”: {rn “resultsReturned”: “2”,rn “bytesReturned”: “190”,rn “executionDuration”: “0.059943s”,rn “readOperations”: “3”,rn “debugStats”: {rn “index_entries_scanned”: “500”,rn “documents_scanned”: “2”,rn “billing_details”: {rn “index_entries_billable”: “500”,rn “documents_billable”: “2”,rn “small_ops”: “0”,rn “min_query_cost”: “0”rn }rn }rn }rn}’), (‘language’, ”), (‘caption’, <wagtail.rich_text.RichText object at 0x3e6498191b50>)])]>

To get started, refer to the Query Explain documentation.

Meeting enterprise needs

One key aspect of enterprise readiness is privacy. Firestore now supports Customer Managed Encryption Keys (CMEK) in preview, which allows you to encrypt data stored at-rest using your own specified encryption key. This is an alternative to Firestore’s default behavior, which generates a Google-managed encryption key to encrypt your data. Your customer-specified key can be stored using the Cloud Key Management service, or you can even use your own external key manager. Get started with the Firestore CMEK documentation.

And to help minimize serving latency and maximize data privacy, you can now deploy Firestore in any available Google Cloud region. You can review a full list of supported Firestore locations and pricing here.

Lastly, you can now retain daily backups using Firestore’s Scheduled Backup feature for up to 98 days, up from seven days. Get started with Firestore Scheduled Backup and Restore today.

Next steps

To learn more about Firestore and the new features launching at Next ‘24, check out the following resources:

Getting Started on Firestore: server client library or web & mobile client library

Firestore Vector Search documentation

Firestore Vector Search extension to automatically generate embeddings documentation

Firestore Gen AI Library Integrations: LangChain and LlamaIndex

Firestore Multiple Range queries documentation

Firestore Query Explain documentation

Firestore Customer Managed Encryption Keys documentation

Firestore Locations and Pricing documentation

Firestore Scheduled Backup and Restore documentation

Cloud BlogRead More

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments