user1114907
user1114907

Reputation: 992

How do I search for something other than User?

In Google Cloud Platform/Datastore/Entities with Kind being "User" I'm shown the first 50 User keys (which I can search for successfully with a filter on Key), and next to each User key is displayed the value of an entity "gaeUser", which is a string such as [email protected]. I click 'Filter Entities" and from the dropdown menu I choose "gaeUser". This automatically sets up "is a string equal to", and in the last box I enter 'Joe.gmail.com', which is one of the values of gaeUser shown in the previous display. I am returned "No entities matched this query". I have of course also tried double quote marks or none, with no success. I really need to be able to do such searches, and I can't imagine why I can't. Help?

Upvotes: 0

Views: 83

Answers (2)

Alex
Alex

Reputation: 5276

A screen shot of the unfiltered results showing gaeUser would be useful to see.

Possible issues:

  • the property gaeUser is not indexed
  • the property gaeUser is not type String, but something else
  • the value [email protected] has whitespace in it like a \r\n

EDIT: Added screenshot. If you click on a specific entity in the datastore viewer and then click on a property, it will tell you it's type. enter image description here

EDIT 2:

Hmm, embedded entity. I think you need to search the field gaeUser.email If the dropdown UI doesnt provide that field for you maybe try QUERY BY GQL instead of QUERY BY KIND

SELECT * From `User` where gaeUser.email='[email protected]'

Upvotes: 0

user1114907
user1114907

Reputation: 992

Thanks! That's very helpful, as I had never clicked the right things to get to the page you show. What i see is that gaeUser is in fact indexed, but its type is "embedded entity", whatever that is. I'm also shown the code below. Can I change the type from "embedded entity" to "string" without destroying the datastore? How should I proceed? (I know that this isn't an answer, and that I shouldn't be posting an answer, but I have no idea how to display code intelligibly without using the answer input mechanism (where I see that one can also post an image).

{
  "properties": {
    "auth_domain": {
      "stringValue": "gmail.com",
      "excludeFromIndexes": true
    },
    "user_id": {
      "stringValue": "1114935",
      "excludeFromIndexes": true
    },
    "email": {
      "stringValue": "[email protected]",
      "excludeFromIndexes": true
    }
  }
}

Upvotes: 0

Related Questions