Firebase equalTo doesn't works , tries to get all data
<p>First of all, I know it's common question, but I am really distracted right now, can't really get what I have to do, change schema (which will take too long) or I have some mistake in my code, here is a schema of Firebase nodes, example : <a href="https://i.stack.imgur.com/9vaIR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9vaIR.png" alt="enter image description here"></a></p>

<p>here is how I try to query that data : </p>

<pre><code>firebaseDatabase = FirebaseDatabase.getInstance().getReference()
                        .child("Statistic");

        final Query query = firebaseDatabase
                .orderByChild("Programa")
                .equalTo("0010104")
                .limitToFirst(10);


        query.addValueEventListener(new ValueEventListener()
        {
            public void onDataChange(DataSnapshot dataSnapshot)
            {
               for(DataSnapshot s : dataSnapshot.getChildren())
               {
                   Statistic statistic = s.getValue(Statistic.class);
                   Log.d("Found : ",statistic.getFakulteti());
               }
            }

            public void onCancelled(DatabaseError databaseError)
            {
                DialogFactory.errorPrompt(activity).show();
            }
        });
</code></pre>

<p>but querying doesn't works, after waiting for like minute or half, it tries to get all the data from Firebase that of course causes outOfmemory exception.</p>

<p>Error Log : </p>

<pre><code>Firebase Database encountered an OutOfMemoryError. You may need to reduce the amount of data you are syncing to the client (e.g. by using queries or syncing a deeper path). See https://firebase.google.com/docs/database/ios/structure-data#best_practices_for_data_structure and https://firebase.google.com/docs/database/android/retrieve-data#filtering_data
                                                                        java.lang.OutOfMemoryError: Failed to allocate a 27113000 byte allocation with 16777216 free bytes and 24MB until OOM
                                                                            at java.lang.StringBuilder.toString(StringBuilder.java:408)
                                                                            at com.google.android.gms.internal.zzaje.toString(Unknown Source)
                                                                            at com.google.android.gms.internal.zzajc.zzsm(Unknown Source)
                                                                            at com.google.android.gms.internal.zzajc.zzso(Unknown Source)
                                                                            at com.google.android.gms.internal.zzajc.zza(Unknown Source)
                                                                            at com.google.android.gms.internal.zzajc$zzc$2.run(Unknown Source)
                                                                            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
                                                                            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
                                                                            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
</code></pre>

<p>rule i tried : </p>

<pre><code>{
  "rules": {
    ".read": true,
    ".write": false,
      ".indexOn" : ["Programa"]
  }
}
</code></pre>