Skip to content

Clarification on setTimeout and isTimeout Java API methods #9092

@ppf2

Description

@ppf2

Consider the following example of intentionally setting the query timeout value in the Java API to a very small number:

  SearchResponse sres = client.prepareSearch("index_name")
                    .setTimeout(TimeValue.timeValueNanos(1))
                    .addAggregation(AggregationBuilders.terms("id").field("id").size(1000).shardSize(1000))
                    .execute()
                    .actionGet();
            System.out.println("Is query timed out? " + sres.isTimedOut());

The query returns in > 1 nanosecond, but the isTimedOut parameter is false. Would like to get a clarification on this. Should isTimeOut return true in this case? Or does it not return true because of the following enhancement request (#4586) to actually terminate queries that exceed the query timeout?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions