This is how my entity class looks:
@Entity
@Unindexed
public class User {
...
@Indexed
private int betsCount = 0;
This is how I build/run the query:
objectify.query(User.class).filter("betsCount >", MIN_BETS).iterator()
The index is not being added to datastore-indexes-auto.xml, therefore I can not see it in the dev-console, and naturally the queries (when run on live servers) return nothing.
I know I could add the index (request it to be created) manually but so far automatic creating of indexes seemed to work perfectly for me. So I am wondering what am I missing here.
UPDATE: I did not realize I have to reinsert data when adding @Indexed annotation to existing property.
The query you’re trying to run requires only a single property index. You do not need to specify a custom index for it, and it will not display in the indexes page.
I suspect your issue is related to your use of @Unindexed, something else with the model definition, or possibly the data and criteria you’re using. Check the Objectify docs on indexed / unindexed for a detailed description of indexes. I would also verify that the data actually matches the criteria you’re specifying.