Is it possible to provide a minimal test case with docs to reproduce this? Jörg
On Mon, Aug 4, 2014 at 8:05 PM, John D. Ament <john.d.am...@gmail.com> wrote: > I would think timing as an issue if I got a shorter list of results. I'm > getting too many results in this case. > > > On Monday, August 4, 2014 12:03:35 PM UTC-4, Ivan Brusic wrote: > >> Are you refreshing the index after inserting the test documents? I could >> be simply a matter of timing. >> >> -- >> Ivan >> >> >> On Sun, Aug 3, 2014 at 8:22 AM, John D. Ament <john.d...@gmail.com> >> wrote: >> >>> Hi >>> >>> So after running a few rounds of local automated tests, I've noticed >>> that sometimes I get the wrong results in my index. This seems to only be >>> an issue with my automated tests and not when running the application >>> manually (at least I haven't seen the wrong results after several >>> executions). >>> >>> My search looks like this: >>> >>> SearchResponse searchResponse = esClient.client(). >>> prepareSearch(indexName).setTypes(RECORD_TYPE) >>> .setFetchSource(true) >>> .setPostFilter(FilterBuilders.andFilter( >>> FilterBuilders.inFilter("typeId",types.toArray(new >>> Integer[]{})).cache(false), >>> FilterBuilders.inFilter("stateId",states.toArray(new >>> Integer[]{})).cache(false) >>> ).cache(false)) >>> .addSort("dateCreated.value", SortOrder.DESC) >>> .addSort("recordId",SortOrder.DESC) >>> .execute().actionGet(); >>> >>> The issue appears both with and without the cache flag passed in. >>> >>> The way my tests work is that I execute a bunch of seeds, then run >>> queries against the seeds to verify I get the right results. I'll create 5 >>> records in my test, where the typeId's are always 1,2,3,4 and the stateIds >>> are anything between 1 and 14, except for 6. >>> >>> 5 is a special state in my case. I only want to include that state >>> sometimes. So I'll run one query with all the states except 5 and 6. I >>> expect that this will give me 4 records back (the 5th record is in state >>> 5). Instead I'm getting back 5 results, as if ES is also including state 5 >>> in the list even though I didn't want it. >>> >>> In my test I run this query twice. The test fails sometimes on the >>> first execution, never on the second execution (I have an arquillian >>> deployment, and start up the app once, then seed data, run the first query >>> in one test method, run the second query in a second test method). I'm >>> assuming that these filters are acting like a pure AND - the record must >>> match both fields to be returned. So, any idea why I might be getting the >>> wrong results? >>> >>> John >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "elasticsearch" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to elasticsearc...@googlegroups.com. >>> >>> To view this discussion on the web visit https://groups.google.com/d/ >>> msgid/elasticsearch/c65c050a-2898-4065-b3a5-c8ad0cda0ed1% >>> 40googlegroups.com >>> <https://groups.google.com/d/msgid/elasticsearch/c65c050a-2898-4065-b3a5-c8ad0cda0ed1%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "elasticsearch" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to elasticsearch+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/8930edda-a02d-4765-890e-8f89f47a5451%40googlegroups.com > <https://groups.google.com/d/msgid/elasticsearch/8930edda-a02d-4765-890e-8f89f47a5451%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEQQq4iUgwxcp__yaQ%2B9cbqbfxD%3DzAvmxy5%2BguYK9%3DrNA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.