build.gradle 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. /*
  2. * Licensed to Elasticsearch under one or more contributor
  3. * license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright
  5. * ownership. Elasticsearch licenses this file to you under
  6. * the Apache License, Version 2.0 (the "License"); you may
  7. * not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. apply plugin: 'elasticsearch.docs-test'
  20. /* List of files that have snippets that probably should be converted to
  21. * `// CONSOLE` and `// TESTRESPONSE` but have yet to be converted. Try and
  22. * only remove entries from this list. When it is empty we'll remove it
  23. * entirely and have a party! There will be cake and everything.... */
  24. buildRestTests.expectedUnconvertedCandidates = [
  25. 'plugins/discovery-azure-classic.asciidoc',
  26. 'reference/aggregations.asciidoc',
  27. 'reference/aggregations/bucket/children-aggregation.asciidoc',
  28. 'reference/aggregations/bucket/datehistogram-aggregation.asciidoc',
  29. 'reference/aggregations/bucket/daterange-aggregation.asciidoc',
  30. 'reference/aggregations/bucket/diversified-sampler-aggregation.asciidoc',
  31. 'reference/aggregations/bucket/filter-aggregation.asciidoc',
  32. 'reference/aggregations/bucket/filters-aggregation.asciidoc',
  33. 'reference/aggregations/bucket/geodistance-aggregation.asciidoc',
  34. 'reference/aggregations/bucket/geohashgrid-aggregation.asciidoc',
  35. 'reference/aggregations/bucket/global-aggregation.asciidoc',
  36. 'reference/aggregations/bucket/histogram-aggregation.asciidoc',
  37. 'reference/aggregations/bucket/iprange-aggregation.asciidoc',
  38. 'reference/aggregations/bucket/missing-aggregation.asciidoc',
  39. 'reference/aggregations/bucket/nested-aggregation.asciidoc',
  40. 'reference/aggregations/bucket/range-aggregation.asciidoc',
  41. 'reference/aggregations/bucket/reverse-nested-aggregation.asciidoc',
  42. 'reference/aggregations/bucket/sampler-aggregation.asciidoc',
  43. 'reference/aggregations/bucket/significantterms-aggregation.asciidoc',
  44. 'reference/aggregations/bucket/terms-aggregation.asciidoc',
  45. 'reference/aggregations/matrix/stats-aggregation.asciidoc',
  46. 'reference/aggregations/metrics/avg-aggregation.asciidoc',
  47. 'reference/aggregations/metrics/cardinality-aggregation.asciidoc',
  48. 'reference/aggregations/metrics/extendedstats-aggregation.asciidoc',
  49. 'reference/aggregations/metrics/geobounds-aggregation.asciidoc',
  50. 'reference/aggregations/metrics/geocentroid-aggregation.asciidoc',
  51. 'reference/aggregations/metrics/max-aggregation.asciidoc',
  52. 'reference/aggregations/metrics/min-aggregation.asciidoc',
  53. 'reference/aggregations/metrics/percentile-aggregation.asciidoc',
  54. 'reference/aggregations/metrics/percentile-rank-aggregation.asciidoc',
  55. 'reference/aggregations/metrics/scripted-metric-aggregation.asciidoc',
  56. 'reference/aggregations/metrics/stats-aggregation.asciidoc',
  57. 'reference/aggregations/metrics/sum-aggregation.asciidoc',
  58. 'reference/aggregations/metrics/tophits-aggregation.asciidoc',
  59. 'reference/aggregations/metrics/valuecount-aggregation.asciidoc',
  60. 'reference/aggregations/pipeline.asciidoc',
  61. 'reference/aggregations/pipeline/avg-bucket-aggregation.asciidoc',
  62. 'reference/aggregations/pipeline/bucket-script-aggregation.asciidoc',
  63. 'reference/aggregations/pipeline/bucket-selector-aggregation.asciidoc',
  64. 'reference/aggregations/pipeline/cumulative-sum-aggregation.asciidoc',
  65. 'reference/aggregations/pipeline/derivative-aggregation.asciidoc',
  66. 'reference/aggregations/pipeline/extended-stats-bucket-aggregation.asciidoc',
  67. 'reference/aggregations/pipeline/max-bucket-aggregation.asciidoc',
  68. 'reference/aggregations/pipeline/min-bucket-aggregation.asciidoc',
  69. 'reference/aggregations/pipeline/movavg-aggregation.asciidoc',
  70. 'reference/aggregations/pipeline/percentiles-bucket-aggregation.asciidoc',
  71. 'reference/aggregations/pipeline/serial-diff-aggregation.asciidoc',
  72. 'reference/aggregations/pipeline/stats-bucket-aggregation.asciidoc',
  73. 'reference/aggregations/pipeline/sum-bucket-aggregation.asciidoc',
  74. 'reference/analysis/analyzers/lang-analyzer.asciidoc',
  75. 'reference/analysis/analyzers/pattern-analyzer.asciidoc',
  76. 'reference/analysis/charfilters/htmlstrip-charfilter.asciidoc',
  77. 'reference/analysis/charfilters/pattern-replace-charfilter.asciidoc',
  78. 'reference/analysis/tokenfilters/asciifolding-tokenfilter.asciidoc',
  79. 'reference/analysis/tokenfilters/cjk-bigram-tokenfilter.asciidoc',
  80. 'reference/analysis/tokenfilters/common-grams-tokenfilter.asciidoc',
  81. 'reference/analysis/tokenfilters/compound-word-tokenfilter.asciidoc',
  82. 'reference/analysis/tokenfilters/elision-tokenfilter.asciidoc',
  83. 'reference/analysis/tokenfilters/hunspell-tokenfilter.asciidoc',
  84. 'reference/analysis/tokenfilters/keep-types-tokenfilter.asciidoc',
  85. 'reference/analysis/tokenfilters/keep-words-tokenfilter.asciidoc',
  86. 'reference/analysis/tokenfilters/keyword-marker-tokenfilter.asciidoc',
  87. 'reference/analysis/tokenfilters/keyword-repeat-tokenfilter.asciidoc',
  88. 'reference/analysis/tokenfilters/limit-token-count-tokenfilter.asciidoc',
  89. 'reference/analysis/tokenfilters/lowercase-tokenfilter.asciidoc',
  90. 'reference/analysis/tokenfilters/pattern-capture-tokenfilter.asciidoc',
  91. 'reference/analysis/tokenfilters/snowball-tokenfilter.asciidoc',
  92. 'reference/analysis/tokenfilters/stemmer-override-tokenfilter.asciidoc',
  93. 'reference/analysis/tokenfilters/stemmer-tokenfilter.asciidoc',
  94. 'reference/analysis/tokenfilters/stop-tokenfilter.asciidoc',
  95. 'reference/analysis/tokenfilters/synonym-tokenfilter.asciidoc',
  96. 'reference/analysis/tokenfilters/word-delimiter-tokenfilter.asciidoc',
  97. 'reference/cat.asciidoc',
  98. 'reference/cat/alias.asciidoc',
  99. 'reference/cat/allocation.asciidoc',
  100. 'reference/cat/count.asciidoc',
  101. 'reference/cat/fielddata.asciidoc',
  102. 'reference/cat/health.asciidoc',
  103. 'reference/cat/indices.asciidoc',
  104. 'reference/cat/master.asciidoc',
  105. 'reference/cat/nodeattrs.asciidoc',
  106. 'reference/cat/nodes.asciidoc',
  107. 'reference/cat/pending_tasks.asciidoc',
  108. 'reference/cat/plugins.asciidoc',
  109. 'reference/cat/recovery.asciidoc',
  110. 'reference/cat/repositories.asciidoc',
  111. 'reference/cat/segments.asciidoc',
  112. 'reference/cat/shards.asciidoc',
  113. 'reference/cat/snapshots.asciidoc',
  114. 'reference/cat/templates.asciidoc',
  115. 'reference/cat/thread_pool.asciidoc',
  116. 'reference/cluster.asciidoc',
  117. 'reference/cluster/allocation-explain.asciidoc',
  118. 'reference/cluster/nodes-info.asciidoc',
  119. 'reference/cluster/nodes-stats.asciidoc',
  120. 'reference/cluster/pending.asciidoc',
  121. 'reference/cluster/reroute.asciidoc',
  122. 'reference/cluster/state.asciidoc',
  123. 'reference/cluster/stats.asciidoc',
  124. 'reference/cluster/tasks.asciidoc',
  125. 'reference/cluster/update-settings.asciidoc',
  126. 'reference/docs/bulk.asciidoc',
  127. 'reference/docs/delete-by-query.asciidoc',
  128. 'reference/docs/delete.asciidoc',
  129. 'reference/docs/index_.asciidoc',
  130. 'reference/docs/multi-get.asciidoc',
  131. 'reference/docs/multi-termvectors.asciidoc',
  132. 'reference/docs/reindex.asciidoc',
  133. 'reference/docs/termvectors.asciidoc',
  134. 'reference/docs/update-by-query.asciidoc',
  135. 'reference/docs/update.asciidoc',
  136. 'reference/getting-started.asciidoc',
  137. 'reference/index-modules/similarity.asciidoc',
  138. 'reference/index-modules/store.asciidoc',
  139. 'reference/index-modules/translog.asciidoc',
  140. 'reference/indices/analyze.asciidoc',
  141. 'reference/indices/flush.asciidoc',
  142. 'reference/indices/get-field-mapping.asciidoc',
  143. 'reference/indices/get-settings.asciidoc',
  144. 'reference/indices/put-mapping.asciidoc',
  145. 'reference/indices/recovery.asciidoc',
  146. 'reference/indices/segments.asciidoc',
  147. 'reference/indices/shadow-replicas.asciidoc',
  148. 'reference/indices/shard-stores.asciidoc',
  149. 'reference/indices/update-settings.asciidoc',
  150. 'reference/indices/upgrade.asciidoc',
  151. 'reference/ingest/ingest-node.asciidoc',
  152. 'reference/mapping/dynamic/templates.asciidoc',
  153. 'reference/mapping/fields/all-field.asciidoc',
  154. 'reference/mapping/params/analyzer.asciidoc',
  155. 'reference/mapping/types/binary.asciidoc',
  156. 'reference/mapping/types/geo-point.asciidoc',
  157. 'reference/mapping/types/geo-shape.asciidoc',
  158. 'reference/mapping/types/ip.asciidoc',
  159. 'reference/mapping/types/nested.asciidoc',
  160. 'reference/mapping/types/object.asciidoc',
  161. 'reference/mapping/types/percolator.asciidoc',
  162. 'reference/modules/cluster/misc.asciidoc',
  163. 'reference/modules/indices/request_cache.asciidoc',
  164. 'reference/modules/scripting/native.asciidoc',
  165. 'reference/modules/scripting/security.asciidoc',
  166. 'reference/modules/scripting/using.asciidoc',
  167. 'reference/modules/transport.asciidoc',
  168. 'reference/query-dsl/exists-query.asciidoc',
  169. 'reference/query-dsl/function-score-query.asciidoc',
  170. 'reference/query-dsl/geo-shape-query.asciidoc',
  171. 'reference/query-dsl/terms-query.asciidoc',
  172. 'reference/search/field-stats.asciidoc',
  173. 'reference/search/multi-search.asciidoc',
  174. 'reference/search/profile.asciidoc',
  175. 'reference/search/request/highlighting.asciidoc',
  176. 'reference/search/request/inner-hits.asciidoc',
  177. 'reference/search/request/rescore.asciidoc',
  178. 'reference/search/request/scroll.asciidoc',
  179. 'reference/search/search-template.asciidoc',
  180. 'reference/search/suggesters/completion-suggest.asciidoc',
  181. ]
  182. integTest {
  183. cluster {
  184. setting 'script.inline', 'true'
  185. setting 'script.stored', 'true'
  186. setting 'script.max_compilations_per_minute', '1000'
  187. /* Enable regexes in painless so our tests don't complain about example
  188. * snippets that use them. */
  189. setting 'script.painless.regex.enabled', 'true'
  190. Closure configFile = {
  191. extraConfigFile it, "src/test/cluster/config/$it"
  192. }
  193. configFile 'scripts/my_script.js'
  194. configFile 'scripts/my_script.py'
  195. configFile 'userdict_ja.txt'
  196. configFile 'KeywordTokenizer.rbbi'
  197. // Whitelist reindexing from the local node so we can test it.
  198. setting 'reindex.remote.whitelist', 'myself'
  199. }
  200. }
  201. // Build the cluser with all plugins
  202. project.rootProject.subprojects.findAll { it.parent.path == ':plugins' }.each { subproj ->
  203. /* Skip repositories. We just aren't going to be able to test them so it
  204. * doesn't make sense to waste time installing them. */
  205. if (subproj.path.startsWith(':plugins:repository-')) {
  206. return
  207. }
  208. subproj.afterEvaluate { // need to wait until the project has been configured
  209. integTest {
  210. cluster {
  211. plugin subproj.path
  212. }
  213. }
  214. }
  215. }
  216. buildRestTests.docs = fileTree(projectDir) {
  217. // No snippets in here!
  218. exclude 'build.gradle'
  219. // That is where the snippets go, not where they come from!
  220. exclude 'build'
  221. // This file simply doesn't pass yet. We should figure out how to fix it.
  222. exclude 'reference/modules/snapshots.asciidoc'
  223. }
  224. Closure setupTwitter = { String name, int count ->
  225. buildRestTests.setups[name] = '''
  226. - do:
  227. indices.create:
  228. index: twitter
  229. body:
  230. settings:
  231. number_of_shards: 1
  232. number_of_replicas: 1
  233. - do:
  234. bulk:
  235. index: twitter
  236. type: tweet
  237. refresh: true
  238. body: |'''
  239. for (int i = 0; i < count; i++) {
  240. String user, text
  241. if (i == 0) {
  242. user = 'kimchy'
  243. text = 'trying out Elasticsearch'
  244. } else {
  245. user = 'test'
  246. text = "some message with the number $i"
  247. }
  248. buildRestTests.setups[name] += """
  249. {"index":{"_id": "$i"}}
  250. {"user": "$user", "message": "$text", "date": "2009-11-15T14:12:12", "likes": $i}"""
  251. }
  252. }
  253. setupTwitter('twitter', 5)
  254. setupTwitter('big_twitter', 120)
  255. setupTwitter('huge_twitter', 1200)
  256. buildRestTests.setups['host'] = '''
  257. # Fetch the http host. We use the host of the master because we know there will always be a master.
  258. - do:
  259. cluster.state: {}
  260. - set: { master_node: master }
  261. - do:
  262. nodes.info:
  263. metric: [ http ]
  264. - is_true: nodes.$master.http.publish_address
  265. - set: {nodes.$master.http.publish_address: host}
  266. '''
  267. // Used by pipeline aggregation docs
  268. buildRestTests.setups['sales'] = '''
  269. - do:
  270. indices.create:
  271. index: sales
  272. body:
  273. settings:
  274. number_of_shards: 2
  275. number_of_replicas: 1
  276. mappings:
  277. sale:
  278. properties:
  279. type:
  280. type: keyword
  281. - do:
  282. bulk:
  283. index: sales
  284. type: sale
  285. refresh: true
  286. body: |
  287. {"index":{}}
  288. {"date": "2015/01/01 00:00:00", "price": 200, "type": "hat"}
  289. {"index":{}}
  290. {"date": "2015/01/01 00:00:00", "price": 200, "type": "t-shirt"}
  291. {"index":{}}
  292. {"date": "2015/01/01 00:00:00", "price": 150, "type": "bag"}
  293. {"index":{}}
  294. {"date": "2015/02/01 00:00:00", "price": 50, "type": "hat"}
  295. {"index":{}}
  296. {"date": "2015/02/01 00:00:00", "price": 10, "type": "t-shirt"}
  297. {"index":{}}
  298. {"date": "2015/03/01 00:00:00", "price": 200, "type": "hat"}
  299. {"index":{}}
  300. {"date": "2015/03/01 00:00:00", "price": 175, "type": "t-shirt"}'''