Update:
Only when I set the SearchType to something else than 
the QUERY_AND_FETCH the scroll success to finish.

Any idea why QUERY_THEN_FETCH(the default) brings me to an endless loop?

The full code is:

val client = ESClientFactory.createByNode(ESNode.Builder,cluster = 
"test_acm_es")

    val query = QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(), 
FilterBuilders.queryFilter(
      QueryBuilders.queryString("((market:2 AND feed:55) OR (market:2 AND 
feed:32)) AND snapshotNo:[12614 TO 12627]")))

    var result: SearchResponse = client.prepareSearch("orderbook-2014.10.21")
      .setQuery(query)
      .addFields(OBFields.values.map(_.toString).toList: _*)
      .setSearchType(SearchType.QUERY_THEN_FETCH)
      .setSize(1000)
      .addSort(OBFields.updateNo.toString, SortOrder.ASC)
      .setScroll(new Scroll(TimeValue.timeValueMinutes(5)))
    .execute().actionGet()


    println(s"Result total hits:${result.getHits.totalHits()}")
    println(s"Result hits:${result.getHits.getHits().length}")
      do {
//        result = new 
SearchScrollRequestBuilder(client,result.getScrollId).setScroll(TimeValue.timeValueMinutes(2)).execute().actionGet()
        result = 
client.prepareSearchScroll(result.getScrollId).setScroll(TimeValue.timeValueMinutes(2)).execute().actionGet()
        println(s"Iteration=$itr, 
scrollResult=${result.getHits.getHits.length}")
        itr += 1

      } while (result.getHits.getHits.length != 0)



Thanks for any idea...
Yarden

On Wednesday, November 5, 2014 5:52:25 PM UTC+2, Yarden Bar wrote:
>
> I'll try that and report....
>
> Thanks,
> Yarden
>
> On Wednesday, November 5, 2014 2:48:46 PM UTC+2, Yarden Bar wrote:
>>
>> Hi all,
>>
>> I'm encountering a strange behavior when executing a search-scroll on a 
>> single node of ES-1.3.4 with Java client.
>>
>> The scenario is as follows:
>>
>>    1. Start a single node of version 1.3.4
>>    2. Add snapshot repository pointing to version 1.1.1 snapshots
>>    3. Restore snapshots version 1.1.1 snapshot to 1.3.4 node
>>    4. Execute search on an index with 
>>    5. client.prepareSearch("my_index*").setQuery(QueryBuilders.
>>    filteredQuery(QueryBuilders.matchAllQuery(), FilterBuilders.
>>    queryFilter(
>>              QueryBuilders.queryString(s"$terms AND 
>>    snapshotNo:[${mdp.fromSnapshot} TO ${mdp.toSnapshot}]") ))   )
>>     .addFields(OBFields.values.map(_.toString).toList: _*).setSize(
>>    pageSize).addSort(OBFields.updateNo.toString, SortOrder.ASC)
>>            .setScroll(TimeValue.timeValueMinutes(3)).execute().actionGet
>>    ()
>>    
>>    
>>    6. Execute the following search scroll 
>>    client.prepareSearchScroll(scrollId).setScroll(TimeValue.
>>    timeValueMinutes(3)).execute().actionGet()
>>    
>> I have a loop iterating over #6, providing the same scrollId and checking 
>> for (result.getHits().getHits().legth == 0) to terminate.
>> I keep getting the same result 'page' with the same amount of results.
>>
>>
>> Any Idea??
>>
>>
>> Thanks,
>> Yarden
>>
>

-- 
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/6f1a1178-d4e5-41e9-a464-68c6e9204779%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to