Browse Source

Switch to stdlib context package (go1.8+) (#514)

This commit switches Elastic v5 from `"golang.org/x/net/context"` to stdlib `"context"`. It also removes `ctxhttp` and uses stlib `http.Request.WithContext(...)` .

See #425
Erwin 2 years ago
parent
commit
504b3df94c
100 changed files with 101 additions and 201 deletions
  1. 1
    2
      bulk.go
  2. 1
    2
      bulk_processor.go
  3. 1
    2
      bulk_processor_test.go
  4. 1
    2
      bulk_test.go
  5. 1
    2
      clear_scroll.go
  6. 1
    2
      clear_scroll_test.go
  7. 2
    4
      client.go
  8. 1
    2
      client_test.go
  9. 1
    2
      cluster-test/cluster-test.go
  10. 1
    2
      cluster_health.go
  11. 1
    2
      cluster_health_test.go
  12. 1
    2
      cluster_state.go
  13. 1
    2
      cluster_state_test.go
  14. 1
    2
      cluster_stats.go
  15. 1
    2
      cluster_stats_test.go
  16. 1
    2
      count.go
  17. 1
    2
      count_test.go
  18. 1
    2
      decoder_test.go
  19. 1
    2
      delete.go
  20. 1
    2
      delete_by_query.go
  21. 1
    2
      delete_by_query_test.go
  22. 1
    2
      delete_template.go
  23. 1
    2
      delete_template_test.go
  24. 1
    2
      delete_test.go
  25. 1
    2
      example_test.go
  26. 1
    2
      exists.go
  27. 1
    2
      exists_test.go
  28. 1
    2
      explain.go
  29. 1
    2
      explain_test.go
  30. 1
    2
      field_stats.go
  31. 1
    2
      get.go
  32. 1
    2
      get_template.go
  33. 1
    2
      get_template_test.go
  34. 1
    2
      get_test.go
  35. 1
    2
      highlight_test.go
  36. 1
    2
      index.go
  37. 1
    2
      index_test.go
  38. 1
    2
      indices_analyze.go
  39. 1
    2
      indices_analyze_test.go
  40. 1
    2
      indices_close.go
  41. 1
    2
      indices_close_test.go
  42. 1
    2
      indices_create.go
  43. 1
    2
      indices_create_test.go
  44. 1
    2
      indices_delete.go
  45. 1
    2
      indices_delete_template.go
  46. 1
    2
      indices_delete_test.go
  47. 1
    2
      indices_exists.go
  48. 1
    2
      indices_exists_template.go
  49. 1
    2
      indices_exists_template_test.go
  50. 1
    2
      indices_exists_test.go
  51. 1
    2
      indices_exists_type.go
  52. 1
    2
      indices_exists_type_test.go
  53. 1
    2
      indices_flush.go
  54. 1
    2
      indices_flush_test.go
  55. 1
    2
      indices_forcemerge.go
  56. 1
    2
      indices_forcemerge_test.go
  57. 1
    2
      indices_get.go
  58. 1
    2
      indices_get_aliases.go
  59. 1
    2
      indices_get_aliases_test.go
  60. 1
    2
      indices_get_field_mapping.go
  61. 1
    2
      indices_get_mapping.go
  62. 1
    2
      indices_get_settings.go
  63. 1
    2
      indices_get_settings_test.go
  64. 1
    2
      indices_get_template.go
  65. 1
    2
      indices_get_test.go
  66. 1
    2
      indices_open.go
  67. 1
    2
      indices_open_test.go
  68. 1
    2
      indices_put_alias.go
  69. 1
    2
      indices_put_alias_test.go
  70. 1
    2
      indices_put_mapping.go
  71. 1
    2
      indices_put_mapping_test.go
  72. 1
    2
      indices_put_settings.go
  73. 1
    2
      indices_put_settings_test.go
  74. 1
    2
      indices_put_template.go
  75. 1
    2
      indices_refresh.go
  76. 1
    2
      indices_refresh_test.go
  77. 1
    2
      indices_rollover.go
  78. 1
    2
      indices_shrink.go
  79. 1
    2
      indices_stats.go
  80. 1
    2
      indices_stats_test.go
  81. 1
    2
      ingest_delete_pipeline.go
  82. 1
    2
      ingest_get_pipeline.go
  83. 1
    2
      ingest_put_pipeline.go
  84. 1
    2
      ingest_simulate_pipeline.go
  85. 1
    2
      mget.go
  86. 1
    2
      mget_test.go
  87. 1
    2
      msearch.go
  88. 1
    2
      msearch_test.go
  89. 1
    2
      mtermvectors.go
  90. 1
    2
      mtermvectors_test.go
  91. 1
    2
      nodes_info.go
  92. 1
    2
      nodes_info_test.go
  93. 1
    2
      nodes_stats.go
  94. 1
    2
      nodes_stats_test.go
  95. 1
    2
      percolate_test.go
  96. 2
    4
      ping.go
  97. 1
    2
      ping_test.go
  98. 1
    1
      plugins.go
  99. 1
    2
      put_template.go
  100. 0
    0
      put_template_test.go

+ 1
- 2
bulk.go View File

@@ -6,12 +6,11 @@ package elastic
6 6
 
7 7
 import (
8 8
 	"bytes"
9
+	"context"
9 10
 	"errors"
10 11
 	"fmt"
11 12
 	"net/url"
12 13
 
13
-	"golang.org/x/net/context"
14
-
15 14
 	"gopkg.in/olivere/elastic.v5/uritemplates"
16 15
 )
17 16
 

+ 1
- 2
bulk_processor.go View File

@@ -5,11 +5,10 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"sync"
9 10
 	"sync/atomic"
10 11
 	"time"
11
-
12
-	"golang.org/x/net/context"
13 12
 )
14 13
 
15 14
 // BulkProcessorService allows to easily process bulk requests. It allows setting

+ 1
- 2
bulk_processor_test.go View File

@@ -5,13 +5,12 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"math/rand"
10 11
 	"sync/atomic"
11 12
 	"testing"
12 13
 	"time"
13
-
14
-	"golang.org/x/net/context"
15 14
 )
16 15
 
17 16
 func TestBulkProcessorDefaults(t *testing.T) {

+ 1
- 2
bulk_test.go View File

@@ -5,10 +5,9 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"testing"
10
-
11
-	"golang.org/x/net/context"
12 11
 )
13 12
 
14 13
 func TestBulk(t *testing.T) {

+ 1
- 2
clear_scroll.go View File

@@ -5,10 +5,9 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10
-
11
-	"golang.org/x/net/context"
12 11
 )
13 12
 
14 13
 // ClearScrollService clears one or more scroll contexts by their ids.

+ 1
- 2
clear_scroll_test.go View File

@@ -5,10 +5,9 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	_ "net/http"
9 10
 	"testing"
10
-
11
-	"golang.org/x/net/context"
12 11
 )
13 12
 
14 13
 func TestClearScroll(t *testing.T) {

+ 2
- 4
client.go View File

@@ -6,6 +6,7 @@ package elastic
6 6
 
7 7
 import (
8 8
 	"bytes"
9
+	"context"
9 10
 	"encoding/json"
10 11
 	"errors"
11 12
 	"fmt"
@@ -16,9 +17,6 @@ import (
16 17
 	"strings"
17 18
 	"sync"
18 19
 	"time"
19
-
20
-	"golang.org/x/net/context"
21
-	"golang.org/x/net/context/ctxhttp"
22 20
 )
23 21
 
24 22
 const (
@@ -1204,7 +1202,7 @@ func (c *Client) PerformRequest(ctx context.Context, method, path string, params
1204 1202
 		c.dumpRequest((*http.Request)(req))
1205 1203
 
1206 1204
 		// Get response
1207
-		res, err := ctxhttp.Do(ctx, c.c, (*http.Request)(req))
1205
+		res, err := c.c.Do((*http.Request)(req).WithContext(ctx))
1208 1206
 		if err == context.Canceled || err == context.DeadlineExceeded {
1209 1207
 			// Proceed, but don't mark the node as dead
1210 1208
 			return nil, err

+ 1
- 2
client_test.go View File

@@ -6,6 +6,7 @@ package elastic
6 6
 
7 7
 import (
8 8
 	"bytes"
9
+	"context"
9 10
 	"encoding/json"
10 11
 	"errors"
11 12
 	"fmt"
@@ -15,8 +16,6 @@ import (
15 16
 	"strings"
16 17
 	"testing"
17 18
 	"time"
18
-
19
-	"golang.org/x/net/context"
20 19
 )
21 20
 
22 21
 func findConn(s string, slice ...*conn) (int, bool) {

+ 1
- 2
cluster-test/cluster-test.go View File

@@ -5,6 +5,7 @@
5 5
 package main
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"errors"
10 11
 	"flag"
@@ -17,8 +18,6 @@ import (
17 18
 	"sync/atomic"
18 19
 	"time"
19 20
 
20
-	"golang.org/x/net/context"
21
-
22 21
 	elastic "gopkg.in/olivere/elastic.v5"
23 22
 )
24 23
 

+ 1
- 2
cluster_health.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
cluster_health_test.go View File

@@ -5,10 +5,9 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"net/url"
9 10
 	"testing"
10
-
11
-	"golang.org/x/net/context"
12 11
 )
13 12
 
14 13
 func TestClusterHealth(t *testing.T) {

+ 1
- 2
cluster_state.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
cluster_state_test.go View File

@@ -5,10 +5,9 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"net/url"
9 10
 	"testing"
10
-
11
-	"golang.org/x/net/context"
12 11
 )
13 12
 
14 13
 func TestClusterState(t *testing.T) {

+ 1
- 2
cluster_stats.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
cluster_stats_test.go View File

@@ -5,10 +5,9 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"net/url"
9 10
 	"testing"
10
-
11
-	"golang.org/x/net/context"
12 11
 )
13 12
 
14 13
 func TestClusterStats(t *testing.T) {

+ 1
- 2
count.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
count_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestCountURL(t *testing.T) {

+ 1
- 2
decoder_test.go View File

@@ -6,11 +6,10 @@ package elastic
6 6
 
7 7
 import (
8 8
 	"bytes"
9
+	"context"
9 10
 	"encoding/json"
10 11
 	"sync/atomic"
11 12
 	"testing"
12
-
13
-	"golang.org/x/net/context"
14 13
 )
15 14
 
16 15
 type decoder struct {

+ 1
- 2
delete.go View File

@@ -5,11 +5,10 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 
11
-	"golang.org/x/net/context"
12
-
13 12
 	"gopkg.in/olivere/elastic.v5/uritemplates"
14 13
 )
15 14
 

+ 1
- 2
delete_by_query.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
delete_by_query_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestDeleteByQueryBuildURL(t *testing.T) {

+ 1
- 2
delete_template.go View File

@@ -5,11 +5,10 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 
11
-	"golang.org/x/net/context"
12
-
13 12
 	"gopkg.in/olivere/elastic.v5/uritemplates"
14 13
 )
15 14
 

+ 1
- 2
delete_template_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestDeleteTemplateValidate(t *testing.T) {

+ 1
- 2
delete_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestDelete(t *testing.T) {

+ 1
- 2
example_test.go View File

@@ -5,6 +5,7 @@
5 5
 package elastic_test
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"fmt"
10 11
 	"log"
@@ -12,8 +13,6 @@ import (
12 13
 	"reflect"
13 14
 	"time"
14 15
 
15
-	"golang.org/x/net/context"
16
-
17 16
 	elastic "gopkg.in/olivere/elastic.v5"
18 17
 )
19 18
 

+ 1
- 2
exists.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/http"
10 11
 	"net/url"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
exists_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestExists(t *testing.T) {

+ 1
- 2
explain.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
explain_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestExplain(t *testing.T) {

+ 1
- 2
field_stats.go View File

@@ -5,13 +5,12 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/http"
10 11
 	"net/url"
11 12
 	"strings"
12 13
 
13
-	"golang.org/x/net/context"
14
-
15 14
 	"gopkg.in/olivere/elastic.v5/uritemplates"
16 15
 )
17 16
 

+ 1
- 2
get.go View File

@@ -5,13 +5,12 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"fmt"
10 11
 	"net/url"
11 12
 	"strings"
12 13
 
13
-	"golang.org/x/net/context"
14
-
15 14
 	"gopkg.in/olivere/elastic.v5/uritemplates"
16 15
 )
17 16
 

+ 1
- 2
get_template.go View File

@@ -5,11 +5,10 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 
11
-	"golang.org/x/net/context"
12
-
13 12
 	"gopkg.in/olivere/elastic.v5/uritemplates"
14 13
 )
15 14
 

+ 1
- 2
get_template_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestGetPutDeleteTemplate(t *testing.T) {

+ 1
- 2
get_test.go View File

@@ -5,10 +5,9 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"testing"
10
-
11
-	"golang.org/x/net/context"
12 11
 )
13 12
 
14 13
 func TestGet(t *testing.T) {

+ 1
- 2
highlight_test.go View File

@@ -5,10 +5,9 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"testing"
10
-
11
-	"golang.org/x/net/context"
12 11
 )
13 12
 
14 13
 func TestHighlighterField(t *testing.T) {

+ 1
- 2
index.go View File

@@ -5,11 +5,10 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 
11
-	"golang.org/x/net/context"
12
-
13 12
 	"gopkg.in/olivere/elastic.v5/uritemplates"
14 13
 )
15 14
 

+ 1
- 2
index_test.go View File

@@ -5,10 +5,9 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"testing"
10
-
11
-	"golang.org/x/net/context"
12 11
 )
13 12
 
14 13
 func TestIndexLifecycle(t *testing.T) {

+ 1
- 2
indices_analyze.go View File

@@ -5,11 +5,10 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 
11
-	"golang.org/x/net/context"
12
-
13 12
 	"gopkg.in/olivere/elastic.v5/uritemplates"
14 13
 )
15 14
 

+ 1
- 2
indices_analyze_test.go View File

@@ -1,9 +1,8 @@
1 1
 package elastic
2 2
 
3 3
 import (
4
+	"context"
4 5
 	"testing"
5
-
6
-	"golang.org/x/net/context"
7 6
 )
8 7
 
9 8
 func TestIndicesAnalyzeURL(t *testing.T) {

+ 1
- 2
indices_close.go View File

@@ -5,11 +5,10 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 
11
-	"golang.org/x/net/context"
12
-
13 12
 	"gopkg.in/olivere/elastic.v5/uritemplates"
14 13
 )
15 14
 

+ 1
- 2
indices_close_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 // TODO(oe): Find out why this test fails on Travis CI.

+ 1
- 2
indices_create.go View File

@@ -5,11 +5,10 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"errors"
9 10
 	"net/url"
10 11
 
11
-	"golang.org/x/net/context"
12
-
13 12
 	"gopkg.in/olivere/elastic.v5/uritemplates"
14 13
 )
15 14
 

+ 1
- 2
indices_create_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestIndicesLifecycle(t *testing.T) {

+ 1
- 2
indices_delete.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
indices_delete_template.go View File

@@ -5,11 +5,10 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 
11
-	"golang.org/x/net/context"
12
-
13 12
 	"gopkg.in/olivere/elastic.v5/uritemplates"
14 13
 )
15 14
 

+ 1
- 2
indices_delete_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestIndicesDeleteValidate(t *testing.T) {

+ 1
- 2
indices_exists.go View File

@@ -5,13 +5,12 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/http"
10 11
 	"net/url"
11 12
 	"strings"
12 13
 
13
-	"golang.org/x/net/context"
14
-
15 14
 	"gopkg.in/olivere/elastic.v5/uritemplates"
16 15
 )
17 16
 

+ 1
- 2
indices_exists_template.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/http"
10 11
 	"net/url"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
indices_exists_template_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestIndexExistsTemplate(t *testing.T) {

+ 1
- 2
indices_exists_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestIndicesExistsWithoutIndex(t *testing.T) {

+ 1
- 2
indices_exists_type.go View File

@@ -5,13 +5,12 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/http"
10 11
 	"net/url"
11 12
 	"strings"
12 13
 
13
-	"golang.org/x/net/context"
14
-
15 14
 	"gopkg.in/olivere/elastic.v5/uritemplates"
16 15
 )
17 16
 

+ 1
- 2
indices_exists_type_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestIndicesExistsTypeBuildURL(t *testing.T) {

+ 1
- 2
indices_flush.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
indices_flush_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestFlush(t *testing.T) {

+ 1
- 2
indices_forcemerge.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
indices_forcemerge_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestIndicesForcemergeBuildURL(t *testing.T) {

+ 1
- 2
indices_get.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
indices_get_aliases.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
indices_get_aliases_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestAliasesBuildURL(t *testing.T) {

+ 1
- 2
indices_get_field_mapping.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
indices_get_mapping.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
indices_get_settings.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
indices_get_settings_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestIndexGetSettingsURL(t *testing.T) {

+ 1
- 2
indices_get_template.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
indices_get_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestIndicesGetValidate(t *testing.T) {

+ 1
- 2
indices_open.go View File

@@ -5,11 +5,10 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 
11
-	"golang.org/x/net/context"
12
-
13 12
 	"gopkg.in/olivere/elastic.v5/uritemplates"
14 13
 )
15 14
 

+ 1
- 2
indices_open_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestIndicesOpenValidate(t *testing.T) {

+ 1
- 2
indices_put_alias.go View File

@@ -5,11 +5,10 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11
-
12
-	"golang.org/x/net/context"
13 12
 )
14 13
 
15 14
 // -- Actions --

+ 1
- 2
indices_put_alias_test.go View File

@@ -5,10 +5,9 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"testing"
10
-
11
-	"golang.org/x/net/context"
12 11
 )
13 12
 
14 13
 const (

+ 1
- 2
indices_put_mapping.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
indices_put_mapping_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestPutMappingURL(t *testing.T) {

+ 1
- 2
indices_put_settings.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
indices_put_settings_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestIndicesPutSettingsBuildURL(t *testing.T) {

+ 1
- 2
indices_put_template.go View File

@@ -5,11 +5,10 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 
11
-	"golang.org/x/net/context"
12
-
13 12
 	"gopkg.in/olivere/elastic.v5/uritemplates"
14 13
 )
15 14
 

+ 1
- 2
indices_refresh.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
indices_refresh_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestRefreshBuildURL(t *testing.T) {

+ 1
- 2
indices_rollover.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"fmt"
10 11
 	"net/url"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
indices_shrink.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"fmt"
10 11
 	"net/url"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
indices_stats.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
indices_stats_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestIndexStatsBuildURL(t *testing.T) {

+ 1
- 2
ingest_delete_pipeline.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"fmt"
10 11
 	"net/url"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
ingest_get_pipeline.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
ingest_put_pipeline.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"fmt"
10 11
 	"net/url"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
ingest_simulate_pipeline.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"fmt"
10 11
 	"net/url"
11 12
 
12
-	"golang.org/x/net/context"
13
-
14 13
 	"gopkg.in/olivere/elastic.v5/uritemplates"
15 14
 )
16 15
 

+ 1
- 2
mget.go View File

@@ -5,11 +5,10 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11
-
12
-	"golang.org/x/net/context"
13 12
 )
14 13
 
15 14
 // MgetService allows to get multiple documents based on an index,

+ 1
- 2
mget_test.go View File

@@ -5,10 +5,9 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"testing"
10
-
11
-	"golang.org/x/net/context"
12 11
 )
13 12
 
14 13
 func TestMultiGet(t *testing.T) {

+ 1
- 2
msearch.go View File

@@ -5,12 +5,11 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"fmt"
10 11
 	"net/url"
11 12
 	"strings"
12
-
13
-	"golang.org/x/net/context"
14 13
 )
15 14
 
16 15
 // MultiSearch executes one or more searches in one roundtrip.

+ 1
- 2
msearch_test.go View File

@@ -5,11 +5,10 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	_ "net/http"
10 11
 	"testing"
11
-
12
-	"golang.org/x/net/context"
13 12
 )
14 13
 
15 14
 func TestMultiSearch(t *testing.T) {

+ 1
- 2
mtermvectors.go View File

@@ -5,13 +5,12 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"fmt"
10 11
 	"net/url"
11 12
 	"strings"
12 13
 
13
-	"golang.org/x/net/context"
14
-
15 14
 	"gopkg.in/olivere/elastic.v5/uritemplates"
16 15
 )
17 16
 

+ 1
- 2
mtermvectors_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestMultiTermVectorsValidateAndBuildURL(t *testing.T) {

+ 1
- 2
nodes_info.go View File

@@ -5,13 +5,12 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 	"strings"
11 12
 	"time"
12 13
 
13
-	"golang.org/x/net/context"
14
-
15 14
 	"gopkg.in/olivere/elastic.v5/uritemplates"
16 15
 )
17 16
 

+ 1
- 2
nodes_info_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestNodesInfo(t *testing.T) {

+ 1
- 2
nodes_stats.go View File

@@ -5,13 +5,12 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"fmt"
10 11
 	"net/url"
11 12
 	"strings"
12 13
 
13
-	"golang.org/x/net/context"
14
-
15 14
 	"gopkg.in/olivere/elastic.v5/uritemplates"
16 15
 )
17 16
 

+ 1
- 2
nodes_stats_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestNodesStats(t *testing.T) {

+ 1
- 2
percolate_test.go View File

@@ -5,9 +5,8 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"testing"
9
-
10
-	"golang.org/x/net/context"
11 10
 )
12 11
 
13 12
 func TestPercolate(t *testing.T) {

+ 2
- 4
ping.go View File

@@ -5,12 +5,10 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"encoding/json"
9 10
 	"net/http"
10 11
 	"net/url"
11
-
12
-	"golang.org/x/net/context"
13
-	"golang.org/x/net/context/ctxhttp"
14 12
 )
15 13
 
16 14
 // PingService checks if an Elasticsearch server on a given URL is alive.
@@ -111,7 +109,7 @@ func (s *PingService) Do(ctx context.Context) (*PingResult, int, error) {
111 109
 		req.SetBasicAuth(basicAuthUsername, basicAuthPassword)
112 110
 	}
113 111
 
114
-	res, err := ctxhttp.Do(ctx, s.client.c, (*http.Request)(req))
112
+	res, err := s.client.c.Do((*http.Request)(req).WithContext(ctx))
115 113
 	if err != nil {
116 114
 		return nil, 0, err
117 115
 	}

+ 1
- 2
ping_test.go View File

@@ -5,10 +5,9 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"net/http"
9 10
 	"testing"
10
-
11
-	"golang.org/x/net/context"
12 11
 )
13 12
 
14 13
 func TestPingGet(t *testing.T) {

+ 1
- 1
plugins.go View File

@@ -4,7 +4,7 @@
4 4
 
5 5
 package elastic
6 6
 
7
-import "golang.org/x/net/context"
7
+import "context"
8 8
 
9 9
 // HasPlugin indicates whether the cluster has the named plugin.
10 10
 func (c *Client) HasPlugin(name string) (bool, error) {

+ 1
- 2
put_template.go View File

@@ -5,11 +5,10 @@
5 5
 package elastic
6 6
 
7 7
 import (
8
+	"context"
8 9
 	"fmt"
9 10
 	"net/url"
10 11
 
11
-	"golang.org/x/net/context"
12
-
13 12
 	"gopkg.in/olivere/elastic.v5/uritemplates"
14 13
 )
15 14
 

+ 0
- 0
put_template_test.go View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save