Create composite index in AppEngine + Firestore in Native Mode - google-app-engine

We are currently developing an AppEngine Standard application using Cloud Firestore in Native Mode which is working very well.
Now, we want to support a query that needs a composite index which we try to create using a index.yaml file:
indexes:
- kind: myentity
properties:
- name: owner
direction: asc
- name: created_at
direction: asc
When testing this with gcloud app deploy index.yaml, we observe that indexes are being created. However, the created indexes are Cloud Datastore indexes not Cloud Firestore ones, even though Datastore is "not even enabled" (The Cloud console wants to send you directly to Firestore view if you try to access the Datastore view).
Therefore, our queries are failing.
How do we instruct AppEngine to create Firestore indexes not Datastore indexes?

For composite indexes in Firestore (native mode) you can use the gcloud cli or the cloud console.
If you would like to check in your indexes into a configuration file, you can also use Terraform.

Related

Firestore and Datastore in the same GAE project

I have a Google App Engine project and I use Datastore.
I see that under the firebase console, I also have the option to create a Firestore database.
Does this Firestore database use the underlying Datastore in the same GAE project? I'm guessing maybe it lives side by side with Datastore?
That being said, can I use Firestore and Datastore in the same project?
Let me know if I am missing something...
They are related.
But in addition to not being able to use both in the same project you should be careful if/when you decide to switch as the switch isn't reversible (or at least not yet). Take the time to dive into the documentation to make an informed decision.
From Choosing between Cloud Firestore and Cloud Datastore:
Cloud Firestore is the next major version of Cloud Datastore and a re-
branding of the product. Taking the best of Cloud Datastore and the
Firebase Realtime Database, Cloud Firestore is a NoSQL document
database built for automatic scaling, high performance, and ease of
application development.
and
Warning: Once your database option is set, you cannot switch. You can't use both Cloud Firestore and Cloud Datastore in the same
project.
You can not. From the documentation:
Cloud Firestore and App Engine: You can't use both Cloud Firestore and
Cloud Datastore in the same project, which might affect apps using App
Engine. Try using Cloud Firestore with a different project.

I cannot enable firestore on a project although I'm not using AppEngine nor Datastore

I'm trying to activate firestore on a project on which I'm not using AppEngine nor Datastore and having this error message.
Cannot enable Firestore for this project
Currently Firestore cannot be enabled in projects already using Cloud Datastore or App Engine
To be more precise, I used to use datastore but now there is no entities in my project datastore. So maybe there is something that I need to disable explicitly
Thx in advance for your help
Unfortunately since you have previously used Cloud Datastore in that project, you cannot create a Cloud Firestore instance. Our ability to switch it currently only works if it was never used in the past.
go to the Project Settings and add Default GCP resource location:
Then try to create database

how can I query to firebase realtime database?

I am developing an Android app using the Firebase.
It uses Firebase Auth, Real-time database, Storage.
And the App has a search feature.
For example, a customer can search another user using this feature.
If there is a user "Yoonho Aaron Kim", user want to search this user using some keyword like "yoonho", "aaron", "kim", etc...
But the Firebase Query doesn't support all of them.
It provides only "startAt", "endAt", "equalTo" methods.
Plus, I cannot use these 3 methods at the same time.
Because of this limitation, I am considering another module like "Cloud SQL", "App Engine".
Is there any good ideas please?
AppEngine is actually not a database engine, it is a "platform to build apps and scale automatically" and as such can connect to different types of databases: Cloud SQL (that you mention) a relational MySQL db (or PostgreSQL) or Cloud Datastore, a NoSQL database.
With Cloud SQL you could indeed perform some queries with a LIKE operator in a WHERE clause. With Datastore you will get the same limitations than Firebase database.
However, switching to AppEngine means that you will stop using Firebase and that you will go for another solution to develop and expose your APIs to your Android app, e.g. use a framework like Google Endpoints (https://cloud.google.com/endpoints/) .

Documents and Indexes/Memcache - how to use from GCE or GKE?

I've been wanting to use the "Documents and Indexes" feature of the Google Cloud platform, but due to the terribly constraints on AppEngine (e.g. I use gRPC, Cloud Endpoints etc etc). So instead I'm using GKE with Golang and it's all working good. My datastore is "Datastore" and I want to index some documents as I'm creating too many indexes that could result in exploding indexes.
How do we use the appengine search API from GKE? I get this error from Google Cloud Platform "not an App Engine context".. so does this mean that AppEngine standard gets the good stuff while users like me are left without these managed services and wondering if we will ever get these services?
So Google, will GKE/GCE users get:
Documents and Indexes (Search API)
Memcache service
Or do we have to roll up our own solution?
At this point you'll have to roll your own solution as App Engine search isn't available as a standalone product outside of App Engine Standard.
For caching you could follow the same advice given to App Engine Flexible users: https://cloud.google.com/appengine/docs/flexible/python/using-redislabs-memcache
Essentially use either Redis Labs Memcache/Redis Cloud offerings.

Project created from App Engine Console comes with less features compared with project created from Cloud Console

When I create a new Application from App Engine Console https://appengine.google.com/,
the application also appears on Cloud Console https://cloud.google.com/console#c=l
However, clicking into the project shows that only these features are included:
App Engine
BigQuery
Cloud Datastore
Compared with Project created directly from Cloud Console:
App Engine
Compute Engine
Cloud Storage
BigQuery
APIs
Cloud Datastore
Cloud SQL
That leads to problem that App Engine project is missing access to many features and there seems no obvious way to add them back later.
Any idea what's wrong here?
1,This only implies that when you create an application from app engine console, it directly creates 3 types of projects: app engine app, datastore instance and big query(i think you need to enable the api first) with the same project id. This does not mean you cannot use the other features. It only means you need to separately enable them and give project ids.
2, If you create a project from cloud console, then it will automatically create projects under all the 7 different categories with the same project ID
Finally I found how to do this:
Go to https://appengine.google.com/
Open your app
Open Administration / Application Settings
Click the button in the "Cloud Integration" section

Resources