# Not all entries having "audio":true are returned

**URL:** <https://discuss.elastic.co/t/not-all-entries-having-audio-true-are-returned/10154>\
**Category:** Elasticsearch\
**Created:** [December 21, 2012, 2:03pm UTC](https://discuss.elastic.co/t/not-all-entries-having-audio-true-are-returned/10154 "2012-12-21T14:03:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stine](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@Stine](https://discuss.elastic.co/u/Stine)\
**Post date:** [December 21, 2012, 2:03pm UTC](https://discuss.elastic.co/t/not-all-entries-having-audio-true-are-returned/10154/1 "2012-12-21T14:03:53Z")

</div>

I have a unit test where I insert a lot of profiles into my Elasticsearch  
index and then execute some different searching queries against the index.

After indexing I refresh using:

client.admin().indices().refresh(refreshRequest("\_all")).actionGet();

After my tests the index is deleted using:

client.admin().indices().prepareDelete("searching").execute().actionGet();

The strange thing is that sometimes all my tests are executed successfully  
and sometimes some of them fail - the reason being that the expected list  
of profiles does not match the actual list of profiles.

One example I have seen is when i search for profiles having audio true  
using a query like this:

{  
"query" : {  
"filtered" : {  
"query" : { "match\_all": {} },  
"filter" : { "and": { "filters": [{ "term": { "audio": true } }] } }  
}  
}  
}

Then I get back the following three profiles:

{  
"took": 1,  
"timed\_out": false,  
"\_shards": {  
"total": 5,  
"successful": 5,  
"failed": 0  
},  
"hits": {  
"total": 3,  
"max\_score": 1,  
"hits": [  
{  
"\_index": "searching",  
"\_type": "profiles",  
"\_id": "9",  
"\_score": 1,  
"\_source": {  
"id": "9",  
"provider": "en\_DK\_TEST",  
"operator": "en\_DK\_TEST",  
"msisdn": "11111112",  
"nickname": "ANNA",  
"age": 35,  
"hasGender": true,  
"gender": "FEMALE",  
"sexPref": "FEMALE",  
"location": "31.Test2.etc",  
"interests": [  
"party"  
],  
"picture": false,  
"video": false,  
"audio": true,  
"online": false,  
"lastActivity": 1356068041004,  
"joinDate": 1356068038885  
}  
},  
{  
"\_index": "searching",  
"\_type": "profiles",  
"\_id": "2",  
"\_score": 1,  
"\_source": {  
"id": "2",  
"provider": "en\_DK\_TEST",  
"operator": "en\_DK\_TEST",  
"msisdn": "33333333",  
"nickname": "JENS",  
"age": 60,  
"hasGender": true,  
"gender": "MALE",  
"sexPref": "FEMALE",  
"location": "32",  
"picture": false,  
"video": false,  
"audio": true,  
"online": false,  
"lastActivity": 1356068040990,  
"joinDate": 1356068038838  
}  
},  
{  
"\_index": "searching",  
"\_type": "profiles",  
"\_id": "10",  
"\_score": 1,  
"\_source": {  
"id": "10",  
"provider": "en\_DK\_TEST",  
"operator": "en\_DK\_TEST",  
"msisdn": "11111113",  
"nickname": "BRENDA",  
"age": 25,  
"hasGender": true,  
"gender": "FEMALE",  
"sexPref": "BOTH",  
"picture": false,  
"video": false,  
"audio": true,  
"online": false,  
"lastActivity": 1356053641006,  
"joinDate": 1356053638891  
}  
}  
]  
}  
}

BUT Henry actually has audit true as well - at least that is what I see  
when I query him using:

{  
"query" : {  
"filtered" : {  
"query" : { "match\_all": {} },  
"filter" : { "and": { "filters": [ { "term": { "nickname": "henry" }  
} ] } }  
}  
}  
}

I get:

{  
"took": 1,  
"timed\_out": false,  
"\_shards": {  
"total": 5,  
"successful": 5,  
"failed": 0  
},  
"hits": {  
"total": 1,  
"max\_score": 1,  
"hits": [  
{  
"\_index": "searching",  
"\_type": "profiles",  
"\_id": "1",  
"\_score": 1,  
"\_source": {  
"id": "1",  
"provider": "en\_DK\_TEST",  
"operator": "en\_DK\_TEST",  
"msisdn": "22222222",  
"nickname": "HENRY",  
"age": 56,  
"hasGender": true,  
"gender": "MALE",  
"sexPref": "FEMALE",  
"location": "31",  
"interests": [  
"party",  
"music"  
],  
"picture": false,  
"video": true,  
"audio": true,  
"online": true,  
"lastActivity": 1356080952448,  
"joinDate": 1356080950416  
}  
}  
]  
}  
}

Why isn't Henrik part of the search result when I search for audio true then?

Would be really great if someone had some kind of idea of what could be going on here.

Thanks a lot,

Stine

--

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 21, 2012, 2:12pm UTC](https://discuss.elastic.co/t/not-all-entries-having-audio-true-are-returned/10154/2 "2012-12-21T14:12:40Z")

</div>

I never used your "\_all" refresh.

Here is how I am doing it:

client . admin (). indices (). prepareRefresh (). execute (). actionGet ();

Does it solve your problem?

David.

Le 21 décembre 2012 à 15:03, Stine [stinesplace@gmail.com](mailto:stinesplace@gmail.com) a écrit :

> I have a unit test where I insert a lot of profiles into my Elasticsearch  
> index and then execute some different searching queries against the index.
> 
> After indexing I refresh using:
> 
> client.admin().indices().refresh(refreshRequest("\_all")).actionGet();  
> After my tests the index is deleted using:
> 
> client.admin().indices().prepareDelete("searching").execute().actionGet();
> 
> The strange thing is that sometimes all my tests are executed successfully  
> and sometimes some of them fail - the reason being that the expected list of  
> profiles does not match the actual list of profiles.
> 
> One example I have seen is when i search for profiles having audio true using  
> a query like this:
> 
> {  
> "query" : {  
> "filtered" : {  
> "query" : { "match\_all": {} },  
> "filter" : { "and": { "filters": [{ "term": { "audio": true } }] } }  
> }  
> }  
> }
> 
> Then I get back the following three profiles:
> 
> {  
> "took": 1,  
> "timed\_out": false,  
> "\_shards": {  
> "total": 5,  
> "successful": 5,  
> "failed": 0  
> },  
> "hits": {  
> "total": 3,  
> "max\_score": 1,  
> "hits": [  
> {  
> "\_index": "searching",  
> "\_type": "profiles",  
> "\_id": "9",  
> "\_score": 1,  
> "\_source": {  
> "id": "9",  
> "provider": "en\_DK\_TEST",  
> "operator": "en\_DK\_TEST",  
> "msisdn": "11111112",  
> "nickname": "ANNA",  
> "age": 35,  
> "hasGender": true,  
> "gender": "FEMALE",  
> "sexPref": "FEMALE",  
> "location": "31.Test2.etc",  
> "interests": [  
> "party"  
> ],  
> "picture": false,  
> "video": false,  
> "audio": true,  
> "online": false,  
> "lastActivity": 1356068041004,  
> "joinDate": 1356068038885  
> }  
> },  
> {  
> "\_index": "searching",  
> "\_type": "profiles",  
> "\_id": "2",  
> "\_score": 1,  
> "\_source": {  
> "id": "2",  
> "provider": "en\_DK\_TEST",  
> "operator": "en\_DK\_TEST",  
> "msisdn": "33333333",  
> "nickname": "JENS",  
> "age": 60,  
> "hasGender": true,  
> "gender": "MALE",  
> "sexPref": "FEMALE",  
> "location": "32",  
> "picture": false,  
> "video": false,  
> "audio": true,  
> "online": false,  
> "lastActivity": 1356068040990,  
> "joinDate": 1356068038838  
> }  
> },  
> {  
> "\_index": "searching",  
> "\_type": "profiles",  
> "\_id": "10",  
> "\_score": 1,  
> "\_source": {  
> "id": "10",  
> "provider": "en\_DK\_TEST",  
> "operator": "en\_DK\_TEST",  
> "msisdn": "11111113",  
> "nickname": "BRENDA",  
> "age": 25,  
> "hasGender": true,  
> "gender": "FEMALE",  
> "sexPref": "BOTH",  
> "picture": false,  
> "video": false,  
> "audio": true,  
> "online": false,  
> "lastActivity": 1356053641006,  
> "joinDate": 1356053638891  
> }  
> }  
> ]  
> }  
> }
> 
> BUT Henry actually has audit true as well - at least that is what I see when  
> I query him using:
> 
> {  
> "query" : {  
> "filtered" : {  
> "query" : { "match\_all": {} },  
> "filter" : { "and": { "filters": [ { "term": { "nickname": "henry" } }  
> ] } }  
> }  
> }  
> }
> 
> I get:
> 
> {  
> "took": 1,  
> "timed\_out": false,  
> "\_shards": {  
> "total": 5,  
> "successful": 5,  
> "failed": 0  
> },  
> "hits": {  
> "total": 1,  
> "max\_score": 1,  
> "hits": [  
> {  
> "\_index": "searching",  
> "\_type": "profiles",  
> "\_id": "1",  
> "\_score": 1,  
> "\_source": {  
> "id": "1",  
> "provider": "en\_DK\_TEST",  
> "operator": "en\_DK\_TEST",  
> "msisdn": "22222222",  
> "nickname": "HENRY",  
> "age": 56,  
> "hasGender": true,  
> "gender": "MALE",  
> "sexPref": "FEMALE",  
> "location": "31",  
> "interests": [  
> "party",  
> "music"  
> ],  
> "picture": false,  
> "video": true,  
> "audio": true,  
> "online": true,  
> "lastActivity": 1356080952448,  
> "joinDate": 1356080950416  
> }  
> }  
> ]  
> }  
> }
> 
> Why isn't Henrik part of the search result when I search for audio true then?
> 
> Would be really great if someone had some kind of idea of what could be going  
> on here.
> 
> Thanks a lot,
> 
> Stine
> 
> --

--  
David Pilato  
[http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<div class="post-metadata">

**Author:** ![Stine](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@Stine](https://discuss.elastic.co/u/Stine)\
**Post date:** [December 21, 2012, 2:16pm UTC](https://discuss.elastic.co/t/not-all-entries-having-audio-true-are-returned/10154/3 "2012-12-21T14:16:50Z")

</div>

Thanks, but seeing the same pattern with your refresh stmt. Sometimes it  
works, sometimes it does not ☹ What I do not understand at all is that I  
can see that Henry's audio flag is actually true in the source I get back  
when querying for him...

Den fredag den 21. december 2012 15.12.40 UTC+1 skrev David Pilato:

> I never used your "\_all" refresh.
> 
> Here is how I am doing it:
> 
> client . admin (). indices (). prepareRefresh (). execute (). actionGet  
> ();
> 
> Does it solve your problem?
> 
> David.
> 
> Le 21 décembre 2012 à 15:03, Stine \<[stine...@gmail.com](mailto:stine...@gmail.com) \<javascript:\>\> a  
> écrit :
> 
> I have a unit test where I insert a lot of profiles into my Elasticsearch  
> index and then execute some different searching queries against the index.
> 
> After indexing I refresh using:
> 
> client.admin().indices().refresh(refreshRequest("\_all")).actionGet();  
> After my tests the index is deleted using:
> 
> client.admin().indices().prepareDelete("searching").execute().actionGet  
> ();
> 
> The strange thing is that sometimes all my tests are executed  
> successfully and sometimes some of them fail - the reason being that the  
> expected list of profiles does not match the actual list of profiles.
> 
> One example I have seen is when i search for profiles having audio true  
> using a query like this:
> 
> {  
> "query" : {  
> "filtered" : {  
> "query" : { "match\_all": {} },  
> "filter" : { "and": { "filters": [{ "term": { "audio": true } }]  
> } }  
> }  
> }  
> }
> 
> Then I get back the following three profiles:
> 
> {  
> "took": 1,  
> "timed\_out": false,  
> "\_shards": {  
> "total": 5,  
> "successful": 5,  
> "failed": 0  
> },  
> "hits": {  
> "total": 3,  
> "max\_score": 1,  
> "hits": [  
> {  
> "\_index": "searching",  
> "\_type": "profiles",  
> "\_id": "9",  
> "\_score": 1,  
> "\_source": {  
> "id": "9",  
> "provider": "en\_DK\_TEST",  
> "operator": "en\_DK\_TEST",  
> "msisdn": "11111112",  
> "nickname": "ANNA",  
> "age": 35,  
> "hasGender": true,  
> "gender": "FEMALE",  
> "sexPref": "FEMALE",  
> "location": "31.Test2.etc",  
> "interests": [  
> "party"  
> ],  
> "picture": false,  
> "video": false,  
> "audio": true,  
> "online": false,  
> "lastActivity": 1356068041004,  
> "joinDate": 1356068038885  
> }  
> },  
> {  
> "\_index": "searching",  
> "\_type": "profiles",  
> "\_id": "2",  
> "\_score": 1,  
> "\_source": {  
> "id": "2",  
> "provider": "en\_DK\_TEST",  
> "operator": "en\_DK\_TEST",  
> "msisdn": "33333333",  
> "nickname": "JENS",  
> "age": 60,  
> "hasGender": true,  
> "gender": "MALE",  
> "sexPref": "FEMALE",  
> "location": "32",  
> "picture": false,  
> "video": false,  
> "audio": true,  
> "online": false,  
> "lastActivity": 1356068040990,  
> "joinDate": 1356068038838  
> }  
> },  
> {  
> "\_index": "searching",  
> "\_type": "profiles",  
> "\_id": "10",  
> "\_score": 1,  
> "\_source": {  
> "id": "10",  
> "provider": "en\_DK\_TEST",  
> "operator": "en\_DK\_TEST",  
> "msisdn": "11111113",  
> "nickname": "BRENDA",  
> "age": 25,  
> "hasGender": true,  
> "gender": "FEMALE",  
> "sexPref": "BOTH",  
> "picture": false,  
> "video": false,  
> "audio": true,  
> "online": false,  
> "lastActivity": 1356053641006,  
> "joinDate": 1356053638891  
> }  
> }  
> ]  
> }  
> }
> 
> BUT Henry actually has audit true as well - at least that is what I see  
> when I query him using:
> 
> {  
> "query" : {  
> "filtered" : {  
> "query" : { "match\_all": {} },  
> "filter" : { "and": { "filters": [ { "term": { "nickname": "henry"  
> } } ] } }  
> }  
> }  
> }
> 
> I get:
> 
> {  
> "took": 1,  
> "timed\_out": false,  
> "\_shards": {  
> "total": 5,  
> "successful": 5,  
> "failed": 0  
> },  
> "hits": {  
> "total": 1,  
> "max\_score": 1,  
> "hits": [  
> {  
> "\_index": "searching",  
> "\_type": "profiles",  
> "\_id": "1",  
> "\_score": 1,  
> "\_source": {  
> "id": "1",  
> "provider": "en\_DK\_TEST",  
> "operator": "en\_DK\_TEST",  
> "msisdn": "22222222",  
> "nickname": "HENRY",  
> "age": 56,  
> "hasGender": true,  
> "gender": "MALE",  
> "sexPref": "FEMALE",  
> "location": "31",  
> "interests": [  
> "party",  
> "music"  
> ],  
> "picture": false,  
> "video": true,  
> "audio": true,  
> "online": true,  
> "lastActivity": 1356080952448,  
> "joinDate": 1356080950416  
> }  
> }  
> ]  
> }  
> }
> 
> Why isn't Henrik part of the search result when I search for audio true then?
> 
> Would be really great if someone had some kind of idea of what could be going on here.
> 
> Thanks a lot,
> 
> Stine
> 
> --
> 
> --  
> David Pilato  
> [http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
> [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 21, 2012, 2:31pm UTC](https://discuss.elastic.co/t/not-all-entries-having-audio-true-are-returned/10154/4 "2012-12-21T14:31:15Z")

</div>

Just wondering if you are using another test tool (like infinitest) or if you  
are working with coworkers on the same lan but with the same cluster name (not  
isolated)?

Could you gist your use case? Or could you reproduce it with a pure curl  
commands sequence and gist it?

David.

Le 21 décembre 2012 à 15:16, Stine [stinesplace@gmail.com](mailto:stinesplace@gmail.com) a écrit :

> Thanks, but seeing the same pattern with your refresh stmt. Sometimes it  
> works, sometimes it does not ☹ What I do not understand at all is that I can  
> see that Henry's audio flag is actually true in the source I get back when  
> querying for him...
> 
> Den fredag den 21. december 2012 15.12.40 UTC+1 skrev David Pilato:
> 
> > > I never used your "\_all" refresh.
> > 
> > Here is how I am doing it:
> > 
> > client . admin (). indices (). prepareRefresh (). execute (). actionGet  
> > ();
> > 
> > Does it solve your problem?
> > 
> > David.
> > 
> > Le 21 décembre 2012 à 15:03, Stine \< [stine...@gmail.com](mailto:stine...@gmail.com)\> a écrit :
> > 
> > ```
> > > > > I have a unit test where I insert a lot of profiles into my
> > > > > Elasticsearch index and then execute some different searching
> > > > > queries against the index.
> > 
> > ```
> > 
> > > ```
> > > After indexing I refresh using:
> > > 
> > > client.admin().indices().refresh(refreshRequest("_all")).actionGet();
> > > After my tests the index is deleted using:
> > > 
> > > ```
> > > 
> > > client.admin().indices().prepareDelete("searching").execute().actionGet();
> > > 
> > > ```
> > > The strange thing is that sometimes all my tests are executed
> > > 
> > > ```
> > > 
> > > successfully and sometimes some of them fail - the reason being that the  
> > > expected list of profiles does not match the actual list of profiles.
> > > 
> > > ```
> > > One example I have seen is when i search for profiles having audio
> > > 
> > > ```
> > > 
> > > true using a query like this:
> > > 
> > > ```
> > > {
> > > "query" : {
> > > "filtered" : {
> > > "query" : { "match_all": {} },
> > > "filter" : { "and": { "filters": [ { "term": { "audio": true } }
> > > 
> > > ```
> > > 
> > > ] } }  
> > > }  
> > > }  
> > > }
> > > 
> > > ```
> > > Then I get back the following three profiles:
> > > 
> > > {
> > > "took": 1,
> > > "timed_out": false,
> > > "_shards": {
> > > "total": 5,
> > > "successful": 5,
> > > "failed": 0
> > > },
> > > "hits": {
> > > "total": 3,
> > > "max_score": 1,
> > > "hits": [
> > > {
> > > "_index": "searching",
> > > "_type": "profiles",
> > > "_id": "9",
> > > "_score": 1,
> > > "_source": {
> > > "id": "9",
> > > "provider": "en_DK_TEST",
> > > "operator": "en_DK_TEST",
> > > "msisdn": "11111112",
> > > "nickname": "ANNA",
> > > "age": 35,
> > > "hasGender": true,
> > > "gender": "FEMALE",
> > > "sexPref": "FEMALE",
> > > "location": "31.Test2.etc",
> > > "interests": [
> > > "party"
> > > ],
> > > "picture": false,
> > > "video": false,
> > > "audio": true,
> > > "online": false,
> > > "lastActivity": 1356068041004,
> > > "joinDate": 1356068038885
> > > }
> > > },
> > > {
> > > "_index": "searching",
> > > "_type": "profiles",
> > > "_id": "2",
> > > "_score": 1,
> > > "_source": {
> > > "id": "2",
> > > "provider": "en_DK_TEST",
> > > "operator": "en_DK_TEST",
> > > "msisdn": "33333333",
> > > "nickname": "JENS",
> > > "age": 60,
> > > "hasGender": true,
> > > "gender": "MALE",
> > > "sexPref": "FEMALE",
> > > "location": "32",
> > > "picture": false,
> > > "video": false,
> > > "audio": true,
> > > "online": false,
> > > "lastActivity": 1356068040990,
> > > "joinDate": 1356068038838
> > > }
> > > },
> > > {
> > > "_index": "searching",
> > > "_type": "profiles",
> > > "_id": "10",
> > > "_score": 1,
> > > "_source": {
> > > "id": "10",
> > > "provider": "en_DK_TEST",
> > > "operator": "en_DK_TEST",
> > > "msisdn": "11111113",
> > > "nickname": "BRENDA",
> > > "age": 25,
> > > "hasGender": true,
> > > "gender": "FEMALE",
> > > "sexPref": "BOTH",
> > > "picture": false,
> > > "video": false,
> > > "audio": true,
> > > "online": false,
> > > "lastActivity": 1356053641006,
> > > "joinDate": 1356053638891
> > > }
> > > }
> > > ]
> > > }
> > > }
> > > 
> > > BUT Henry actually has audit true as well - at least that is what I
> > > 
> > > ```
> > > 
> > > see when I query him using:
> > > 
> > > ```
> > > {
> > > "query" : {
> > > "filtered" : {
> > > "query" : { "match_all": {} },
> > > "filter" : { "and": { "filters": [ { "term": { "nickname":
> > > 
> > > ```
> > > 
> > > "henry" } } ] } }  
> > > }  
> > > }  
> > > }
> > > 
> > > ```
> > > I get:
> > > 
> > > {
> > > "took": 1,
> > > "timed_out": false,
> > > "_shards": {
> > > "total": 5,
> > > "successful": 5,
> > > "failed": 0
> > > },
> > > "hits": {
> > > "total": 1,
> > > "max_score": 1,
> > > "hits": [
> > > {
> > > "_index": "searching",
> > > "_type": "profiles",
> > > "_id": "1",
> > > "_score": 1,
> > > "_source": {
> > > "id": "1",
> > > "provider": "en_DK_TEST",
> > > "operator": "en_DK_TEST",
> > > "msisdn": "22222222",
> > > "nickname": "HENRY",
> > > "age": 56,
> > > "hasGender": true,
> > > "gender": "MALE",
> > > "sexPref": "FEMALE",
> > > "location": "31",
> > > "interests": [
> > > "party",
> > > "music"
> > > ],
> > > "picture": false,
> > > "video": true,
> > > "audio": true,
> > > "online": true,
> > > "lastActivity": 1356080952448,
> > > "joinDate": 1356080950416
> > > }
> > > }
> > > ]
> > > }
> > > }
> > > 
> > > Why isn't Henrik part of the search result when I search for audio
> > > 
> > > ```
> > > 
> > > true then?
> > > 
> > > ```
> > > Would be really great if someone had some kind of idea of what could
> > > 
> > > ```
> > > 
> > > be going on here.
> > > 
> > > ```
> > > Thanks a lot,
> > > 
> > > Stine
> > > 
> > > --
> > > 
> > > ```
> > > 
> > > > >
> > 
> > --  
> > David Pilato  
> > [http://www.scrutmydocs.org/](http://www.scrutmydocs.org/) [http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
> > [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/) [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > >
> 
> --

--  
David Pilato  
[http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [December 21, 2012, 2:51pm UTC](https://discuss.elastic.co/t/not-all-entries-having-audio-true-are-returned/10154/5 "2012-12-21T14:51:35Z")

</div>

Stine,

If you are using dynamic mapping and elasticsearch 0.20.1 you might be  
hitting this bug: [First indexing of a dynamic boolean field can cause it not to be indexed correctly · Issue #2487 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/2487)

Igor

On Friday, December 21, 2012 9:31:15 AM UTC-5, David Pilato wrote:

> Just wondering if you are using another test tool (like infinitest) or  
> if you are working with coworkers on the same lan but with the same cluster  
> name (not isolated)?
> 
> Could you gist your use case? Or could you reproduce it with a pure curl  
> commands sequence and gist it?
> 
> David.
> 
> Le 21 décembre 2012 à 15:16, Stine \<[stine...@gmail.com](mailto:stine...@gmail.com) \<javascript:\>\> a  
> écrit :
> 
> Thanks, but seeing the same pattern with your refresh stmt. Sometimes it  
> works, sometimes it does not ☹ What I do not understand at all is that I  
> can see that Henry's audio flag is actually true in the source I get back  
> when querying for him...
> 
> Den fredag den 21. december 2012 15.12.40 UTC+1 skrev David Pilato:
> 
> I never used your "\_all" refresh.
> 
> Here is how I am doing it:
> 
> client . admin (). indices (). prepareRefresh (). execute (). actionGet  
> ();
> 
> Does it solve your problem?
> 
> David.
> 
> Le 21 décembre 2012 à 15:03, Stine \< [stine...@gmail.com](mailto:stine...@gmail.com)\> a écrit :
> 
> I have a unit test where I insert a lot of profiles into my Elasticsearch  
> index and then execute some different searching queries against the index.
> 
> After indexing I refresh using:
> 
> client.admin().indices().refresh(refreshRequest("\_all")).actionGet();  
> After my tests the index is deleted using:
> 
> client.admin().indices().prepareDelete("searching").execute().actionGet  
> ();
> 
> The strange thing is that sometimes all my tests are executed  
> successfully and sometimes some of them fail - the reason being that the  
> expected list of profiles does not match the actual list of profiles.
> 
> One example I have seen is when i search for profiles having audio true  
> using a query like this:
> 
> {  
> "query" : {  
> "filtered" : {  
> "query" : { "match\_all": {} },  
> "filter" : { "and": { "filters": [{ "term": { "audio": true } }]  
> } }  
> }  
> }  
> }
> 
> Then I get back the following three profiles:
> 
> {  
> "took": 1,  
> "timed\_out": false,  
> "\_shards": {  
> "total": 5,  
> "successful": 5,  
> "failed": 0  
> },  
> "hits": {  
> "total": 3,  
> "max\_score": 1,  
> "hits": [  
> {  
> "\_index": "searching",  
> "\_type": "profiles",  
> "\_id": "9",  
> "\_score": 1,  
> "\_source": {  
> "id": "9",  
> "provider": "en\_DK\_TEST",  
> "operator": "en\_DK\_TEST",  
> "msisdn": "11111112",  
> "nickname": "ANNA",  
> "age": 35,  
> "hasGender": true,  
> "gender": "FEMALE",  
> "sexPref": "FEMALE",  
> "location": "31.Test2.etc",  
> "interests": [  
> "party"  
> ],  
> "picture": false,  
> "video": false,  
> "audio": true,  
> "online": false,  
> "lastActivity": 1356068041004,  
> "joinDate": 1356068038885  
> }  
> },  
> {  
> "\_index": "searching",  
> "\_type": "profiles",  
> "\_id": "2",  
> "\_score": 1,  
> "\_source": {  
> "id": "2",  
> "provider": "en\_DK\_TEST",  
> "operator": "en\_DK\_TEST",  
> "msisdn": "33333333",  
> "nickname": "JENS",  
> "age": 60,  
> "hasGender": true,  
> "gender": "MALE",  
> "sexPref": "FEMALE",  
> "location": "32",  
> "picture": false,  
> "video": false,  
> "audio": true,  
> "online": false,  
> "lastActivity": 1356068040990,  
> "joinDate": 1356068038838  
> }  
> },  
> {  
> "\_index": "searching",  
> "\_type": "profiles",  
> "\_id": "10",  
> "\_score": 1,  
> "\_source": {  
> "id": "10",  
> "provider": "en\_DK\_TEST",  
> "operator": "en\_DK\_TEST",  
> "msisdn": "11111113",  
> "nickname": "BRENDA",  
> "age": 25,  
> "hasGender": true,  
> "gender": "FEMALE",  
> "sexPref": "BOTH",  
> "picture": false,  
> "video": false,  
> "audio": true,  
> "online": false,  
> "lastActivity": 1356053641006,  
> "joinDate": 1356053638891  
> }  
> }  
> ]  
> }  
> }
> 
> BUT Henry actually has audit true as well - at least that is what I see  
> when I query him using:
> 
> {  
> "query" : {  
> "filtered" : {  
> "query" : { "match\_all": {} },  
> "filter" : { "and": { "filters": [ { "term": { "nickname": "henry"  
> } } ] } }  
> }  
> }  
> }
> 
> I get:
> 
> {  
> "took": 1,  
> "timed\_out": false,  
> "\_shards": {  
> "total": 5,  
> "successful": 5,  
> "failed": 0  
> },  
> "hits": {  
> "total": 1,  
> "max\_score": 1,  
> "hits": [  
> {  
> "\_index": "searching",  
> "\_type": "profiles",  
> "\_id": "1",  
> "\_score": 1,  
> "\_source": {  
> "id": "1",  
> "provider": "en\_DK\_TEST",  
> "operator": "en\_DK\_TEST",  
> "msisdn": "22222222",  
> "nickname": "HENRY",  
> "age": 56,  
> "hasGender": true,  
> "gender": "MALE",  
> "sexPref": "FEMALE",  
> "location": "31",  
> "interests": [  
> "party",  
> "music"  
> ],  
> "picture": false,  
> "video": true,  
> "audio": true,  
> "online": true,  
> "lastActivity": 1356080952448,  
> "joinDate": 1356080950416  
> }  
> }  
> ]  
> }  
> }
> 
> Why isn't Henrik part of the search result when I search for audio true then?
> 
> Would be really great if someone had some kind of idea of what could be going on here.
> 
> Thanks a lot,
> 
> Stine
> 
> --
> 
> --  
> David Pilato  
> [http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
> [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> --
> 
> --  
> David Pilato  
> [http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
> [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<div class="post-metadata">

**Author:** ![Stine](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@Stine](https://discuss.elastic.co/u/Stine)\
**Post date:** [December 21, 2012, 4:05pm UTC](https://discuss.elastic.co/t/not-all-entries-having-audio-true-are-returned/10154/6 "2012-12-21T16:05:49Z")

</div>

Hi Igor,

thanks a lot for your answer. I was not using 0.20.1 but nevertheless it  
seemed to help replacing my true/false fields with 1/0 fields. At least I  
have not been able to make my test fail after that change. Thanks!

-Stine

Den fredag den 21. december 2012 15.51.35 UTC+1 skrev Igor Motov:

> Stine,
> 
> If you are using dynamic mapping and elasticsearch 0.20.1 you might be  
> hitting this bug:  
> [First indexing of a dynamic boolean field can cause it not to be indexed correctly · Issue #2487 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/2487)
> 
> Igor
> 
> On Friday, December 21, 2012 9:31:15 AM UTC-5, David Pilato wrote:
> 
> > Just wondering if you are using another test tool (like infinitest) or  
> > if you are working with coworkers on the same lan but with the same cluster  
> > name (not isolated)?
> > 
> > Could you gist your use case? Or could you reproduce it with a pure curl  
> > commands sequence and gist it?
> > 
> > David.
> > 
> > Le 21 décembre 2012 à 15:16, Stine [stine...@gmail.com](mailto:stine...@gmail.com) a écrit :
> > 
> > Thanks, but seeing the same pattern with your refresh stmt. Sometimes it  
> > works, sometimes it does not ☹ What I do not understand at all is that I  
> > can see that Henry's audio flag is actually true in the source I get back  
> > when querying for him...
> > 
> > Den fredag den 21. december 2012 15.12.40 UTC+1 skrev David Pilato:
> > 
> > I never used your "\_all" refresh.
> > 
> > Here is how I am doing it:
> > 
> > client . admin (). indices (). prepareRefresh (). execute (). actionGet  
> > ();
> > 
> > Does it solve your problem?
> > 
> > David.
> > 
> > Le 21 décembre 2012 à 15:03, Stine \< [stine...@gmail.com](mailto:stine...@gmail.com)\> a écrit :
> > 
> > I have a unit test where I insert a lot of profiles into my Elasticsearch  
> > index and then execute some different searching queries against the index.
> > 
> > After indexing I refresh using:
> > 
> > client.admin().indices().refresh(refreshRequest("\_all")).actionGet();  
> > After my tests the index is deleted using:
> > 
> > client.admin().indices().prepareDelete("searching").execute().actionGet  
> > ();
> > 
> > The strange thing is that sometimes all my tests are executed  
> > successfully and sometimes some of them fail - the reason being that the  
> > expected list of profiles does not match the actual list of profiles.
> > 
> > One example I have seen is when i search for profiles having audio true  
> > using a query like this:
> > 
> > {  
> > "query" : {  
> > "filtered" : {  
> > "query" : { "match\_all": {} },  
> > "filter" : { "and": { "filters": [{ "term": { "audio": true } }]  
> > } }  
> > }  
> > }  
> > }
> > 
> > Then I get back the following three profiles:
> > 
> > {  
> > "took": 1,  
> > "timed\_out": false,  
> > "\_shards": {  
> > "total": 5,  
> > "successful": 5,  
> > "failed": 0  
> > },  
> > "hits": {  
> > "total": 3,  
> > "max\_score": 1,  
> > "hits": [  
> > {  
> > "\_index": "searching",  
> > "\_type": "profiles",  
> > "\_id": "9",  
> > "\_score": 1,  
> > "\_source": {  
> > "id": "9",  
> > "provider": "en\_DK\_TEST",  
> > "operator": "en\_DK\_TEST",  
> > "msisdn": "11111112",  
> > "nickname": "ANNA",  
> > "age": 35,  
> > "hasGender": true,  
> > "gender": "FEMALE",  
> > "sexPref": "FEMALE",  
> > "location": "31.Test2.etc",  
> > "interests": [  
> > "party"  
> > ],  
> > "picture": false,  
> > "video": false,  
> > "audio": true,  
> > "online": false,  
> > "lastActivity": 1356068041004,  
> > "joinDate": 1356068038885  
> > }  
> > },  
> > {  
> > "\_index": "searching",  
> > "\_type": "profiles",  
> > "\_id": "2",  
> > "\_score": 1,  
> > "\_source": {  
> > "id": "2",  
> > "provider": "en\_DK\_TEST",  
> > "operator": "en\_DK\_TEST",  
> > "msisdn": "33333333",  
> > "nickname": "JENS",  
> > "age": 60,  
> > "hasGender": true,  
> > "gender": "MALE",  
> > "sexPref": "FEMALE",  
> > "location": "32",  
> > "picture": false,  
> > "video": false,  
> > "audio": true,  
> > "online": false,  
> > "lastActivity": 1356068040990,  
> > "joinDate": 1356068038838  
> > }  
> > },  
> > {  
> > "\_index": "searching",  
> > "\_type": "profiles",  
> > "\_id": "10",  
> > "\_score": 1,  
> > "\_source": {  
> > "id": "10",  
> > "provider": "en\_DK\_TEST",  
> > "operator": "en\_DK\_TEST",  
> > "msisdn": "11111113",  
> > "nickname": "BRENDA",  
> > "age": 25,  
> > "hasGender": true,  
> > "gender": "FEMALE",  
> > "sexPref": "BOTH",  
> > "picture": false,  
> > "video": false,  
> > "audio": true,  
> > "online": false,  
> > "lastActivity": 1356053641006,  
> > "joinDate": 1356053638891  
> > }  
> > }  
> > ]  
> > }  
> > }
> > 
> > BUT Henry actually has audit true as well - at least that is what I see  
> > when I query him using:
> > 
> > {  
> > "query" : {  
> > "filtered" : {  
> > "query" : { "match\_all": {} },  
> > "filter" : { "and": { "filters": [ { "term": { "nickname": "henry"  
> > } } ] } }  
> > }  
> > }  
> > }
> > 
> > I get:
> > 
> > {  
> > "took": 1,  
> > "timed\_out": false,  
> > "\_shards": {  
> > "total": 5,  
> > "successful": 5,  
> > "failed": 0  
> > },  
> > "hits": {  
> > "total": 1,  
> > "max\_score": 1,  
> > "hits": [  
> > {  
> > "\_index": "searching",  
> > "\_type": "profiles",  
> > "\_id": "1",  
> > "\_score": 1,  
> > "\_source": {  
> > "id": "1",  
> > "provider": "en\_DK\_TEST",  
> > "operator": "en\_DK\_TEST",  
> > "msisdn": "22222222",  
> > "nickname": "HENRY",  
> > "age": 56,  
> > "hasGender": true,  
> > "gender": "MALE",  
> > "sexPref": "FEMALE",  
> > "location": "31",  
> > "interests": [  
> > "party",  
> > "music"  
> > ],  
> > "picture": false,  
> > "video": true,  
> > "audio": true,  
> > "online": true,  
> > "lastActivity": 1356080952448,  
> > "joinDate": 1356080950416  
> > }  
> > }  
> > ]  
> > }  
> > }
> > 
> > Why isn't Henrik part of the search result when I search for audio true then?
> > 
> > Would be really great if someone had some kind of idea of what could be going on here.
> > 
> > Thanks a lot,
> > 
> > Stine
> > 
> > --
> > 
> > --  
> > David Pilato  
> > [http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
> > [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > --
> > 
> > --  
> > David Pilato  
> > [http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
> > [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:58am UTC](https://discuss.elastic.co/t/not-all-entries-having-audio-true-are-returned/10154/7 "2017-07-06T02:58:44Z")

</div>

Closed on July 6, 2017, 2:58am UTC


