Open dantalian-pv opened 6 years ago
Thanks for reporting @dantalian-pv. This is indeed producing an error.
Is there a particular issue why you're profiling a scroll search? I think that profiling the search makes sense (query and aggregations), but subsequent scroll searches don't make a lot of sense.
Shorter reproduction:
PUT /index/doc/1
{}
PUT /index/doc/2
{}
GET /index/_search?scroll=1m
{
"profile": true,
"size": 1
}
GET /_search/scroll/{scroll_id}
On the Java Client there is no possibility to enable/disable a profiler for scroll, so, I assume, If the profiler is enabled for the qery, then profiler is enabled for this scroll (Java Client level, I think).
I see, I think profiling should then just be ignored for search scroll invocations.
I started to look into this, and while it's technically possible for the search to be profiled but not the subsequent scrolls... the code is kinda messy. The place where we profile doesn't have access to clearing out the search context, so it needs several messy conditionals to disable profiling on the subsequent scrolls.
I think we should just throw an exception if scroll
and profile
are enabled on the same search, and document the behavior. It shouldn't be a problem for the user, as they can just execute the same search without scroll (same behavior) if I understand how everything works correctly.
@martijnvg @jpountz thoughts?
Since this doesn't work today anyway, I'm +1 to disallow profiling scroll requests for now and documenting it. We can always revisit later if we want to.
Pinging @elastic/es-search-aggs
Pinging @elastic/es-search (Team:Search)
Pinging @elastic/es-search-foundations (Team:Search Foundations)
Elasticsearch version (
bin/elasticsearch --version
):Plugins installed: [
<search-guard-client-version>5.6.4-23</search-guard-client-version>
]JVM version (
java -version
):openjdk version "1.8.0_151"
OS version (
uname -a
if on a Unix-like system):Linux 4.4.92-31-default #1 x86_64 x86_64 x86_64 GNU/Linux
Description of the problem including expected versus actual behavior: When I am trying to use scroll for any search query with enabled profile, scroll request throws the next exception:
Steps to reproduce:
Any index with 2 shard and 2 replicas and >50 documents with any content.
final String scrollId = response.getScrollId();
mElasticClient.prepareSearchScroll(scrollId) .setScroll(TimeValue.timeValueMinutes(1)) .get();