Hmm. So how do I invoke a reindex via the java API?
On Tue, Aug 5, 2014 at 3:40 AM, Tihomir Lichev <shot...@gmail.com> wrote: > I also had timing problems in my automated tests, the solution was to > invoke index refresh and wait for it, then execute any search requests. > This way you can make sure that all test data is ready for searching. > > 03 август 2014, неделя, 18:22:50 UTC+3, John D. Ament написа: > >> 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 a topic in the > Google Groups "elasticsearch" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/elasticsearch/uy0YrsXXw44/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > elasticsearch+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/16211527-5442-4e0e-ae64-62a0f30253d0%40googlegroups.com > <https://groups.google.com/d/msgid/elasticsearch/16211527-5442-4e0e-ae64-62a0f30253d0%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/CAOqetn8Yg3--qYSCvy60B_iqro7abU_cAEG%2BC7-HuzmDpogOfQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.