Created
December 28, 2016 23:17
-
-
Save russcam/8812c1c8bdeccdc034e5dbbd8a07450d to your computer and use it in GitHub Desktop.
Cancellation for async methods in NEST 2.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var client = new ElasticClient(); | |
var cancellationTokenSource = new CancellationTokenSource(); | |
client.Search<Document>(s => s | |
.Query(q => q | |
.MatchAll() | |
) | |
.RequestConfiguration(r => r | |
.CancellationToken(cancellationTokenSource.Token) | |
) | |
); | |
} | |
public class Document | |
{ | |
public string Field { get; set;} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment