Skip to content

Commit 303ff62

Browse files
authored
Merge branch 'main' into ml-inference-rerank
2 parents b59f009 + 4b376b5 commit 303ff62

File tree

100 files changed

+8240
-158
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+8240
-158
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint and Test Jekyll Spec Insert
2+
on:
3+
push:
4+
paths:
5+
- 'spec-insert/**'
6+
pull_request:
7+
paths:
8+
- 'spec-insert/**'
9+
jobs:
10+
lint-and-test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: ruby/setup-ruby@v1
15+
with: { ruby-version: 3.3.0 }
16+
- run: bundle install
17+
- working-directory: spec-insert
18+
run: |
19+
bundle exec rubocop
20+
bundle exec rspec
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Update API Components
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: "0 0 * * 0" # Every Sunday at midnight GMT
6+
jobs:
7+
update-api-components:
8+
if: ${{ github.repository == 'opensearch-project/documentation-website' }}
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
submodules: recursive
17+
fetch-depth: 0
18+
19+
- run: git config --global pull.rebase true
20+
21+
- uses: ruby/setup-ruby@v1
22+
with: { ruby-version: 3.3.0 }
23+
24+
- run: bundle install
25+
26+
- name: Download spec and insert into documentation
27+
run: bundle exec jekyll spec-insert
28+
29+
- name: Get current date
30+
id: date
31+
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
32+
33+
- name: GitHub App token
34+
id: github_app_token
35+
uses: tibdex/[email protected]
36+
with:
37+
app_id: ${{ secrets.APP_ID }}
38+
private_key: ${{ secrets.APP_PRIVATE_KEY }}
39+
40+
- name: Create pull request
41+
uses: peter-evans/create-pull-request@v6
42+
with:
43+
token: ${{ steps.github_app_token.outputs.token }}
44+
commit-message: "Updated API components to reflect the latest OpenSearch API spec (${{ env.date }})"
45+
title: "[AUTOCUT] Update API components to reflect the latest OpenSearch API spec (${{ env.date }})"
46+
body: |
47+
Update API components to reflect the latest [OpenSearch API spec](https://github.com/opensearch-project/opensearch-api-specification/releases/download/main-latest/opensearch-openapi.yaml).
48+
Date: ${{ env.date }}
49+
branch: update-api-components-${{ env.date }}
50+
base: main
51+
signoff: true
52+
labels: autocut

DEVELOPER_GUIDE.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Developer guide
2+
- [Introduction](#introduction)
3+
- [Starting the Jekyll server locally](#starting-the-jekyll-server-locally)
4+
- [Using the spec-insert Jekyll plugin](#using-the-spec-insert-jekyll-plugin)
5+
- [Ignoring files and folders](#ignoring-files-and-folders)
6+
- [CI/CD](#cicd)
7+
- [Spec insert components](#spec-insert-components)
8+
- [Query parameters](#query-parameters)
9+
- [Path parameters](#path-parameters)
10+
- [Paths and HTTP methods](#paths-and-http-methods)
11+
12+
## Introduction
13+
14+
The `.md` documents in this repository are rendered into HTML pages using [Jekyll](https://jekyllrb.com/). These HTML pages are hosted on [opensearch.org](https://opensearch.org/docs/latest/).
15+
16+
## Starting the Jekyll server locally
17+
You can run the Jekyll server locally to view the rendered HTML pages using the following steps:
18+
19+
1. Install [Ruby](https://www.ruby-lang.org/en/documentation/installation/) 3.1.0 or later for your operating system.
20+
2. Install the required gems by running `bundle install`.
21+
3. Run `bundle exec jekyll serve` to start the Jekyll server locally (this can take several minutes to complete).
22+
4. Open your browser and navigate to `http://localhost:4000` to view the rendered HTML pages.
23+
24+
## Using the `spec-insert` Jekyll plugin
25+
The `spec-insert` Jekyll plugin is used to insert API components into Markdown files. The plugin downloads the [latest OpenSearch specification](https://github.com/opensearch-project/opensearch-api-specification) and renders the API components from the spec. This aims to reduce the manual effort required to keep the documentation up to date.
26+
27+
To use this plugin, make sure that you have installed Ruby 3.1.0 or later and the required gems by running `bundle install`.
28+
29+
Edit your Markdown file and insert the following snippet where you want render an API component:
30+
31+
```markdown
32+
<!-- spec_insert_start
33+
api: <API_NAME>
34+
component: <COMPONENT_NAME>
35+
other_argument: <OTHER_ARGUMENT>
36+
-->
37+
38+
This is where the API component will be inserted.
39+
Everything between the `spec_insert_start` and `spec_insert_end` tags will be overwritten.
40+
41+
<!-- spec_insert_end -->
42+
```
43+
44+
Then run the following Jekyll command to render the API components:
45+
```shell
46+
bundle exec jekyll spec-insert
47+
```
48+
49+
If you are working on multiple Markdown files and do not want to keep running the `jekyll spec-insert` command, you can add the `--watch` (or `-W`) flag to the command to watch for changes in the Markdown files and automatically render the API components:
50+
51+
```shell
52+
bundle exec jekyll spec-insert --watch
53+
```
54+
55+
Depending on the text editor you are using, you may need to manually reload the file from disk to see the changes applied by the plugin if the editor does not automatically reload the file periodically.
56+
57+
The plugin will pull the newest OpenSearch API spec from its [repository](https://github.com/opensearch-project/opensearch-api-specification) if the spec file does not exist locally or if it is older than 24 hours. To tell the plugin to always pull the newest spec, you can add the `--refresh-spec` (or `-R`) flag to the command:
58+
59+
```shell
60+
bundle exec jekyll spec-insert --refresh-spec
61+
```
62+
63+
### Ignoring files and folders
64+
The `spec-insert` plugin ignores all files and folders listed in the [./_config.yml#exclude](./_config.yml) list, which is also the list of files and folders that Jekyll ignores.
65+
66+
## CI/CD
67+
The `spec-insert` plugin is run as part of the CI/CD pipeline to ensure that the API components are up to date in the documentation. This is performed through the [update-api-components.yml](.github/workflows/update-api-components.yml) GitHub Actions workflow, which creates a pull request containing the updated API components every Sunday.
68+
69+
## Spec insert components
70+
All spec insert components accept the following arguments:
71+
- `api` (String; required): The name of the API to render the component from. This is equivalent to the `x-operation-group` field in the OpenSearch OpenAPI Spec.
72+
- `component` (String; required): The name of the component to render, such as `query_parameters`, `path_parameters`, or `paths_and_http_methods`.
73+
- `omit_header` (Boolean; Default is `false`): If set to `true`, the markdown header of the component will not be rendered.
74+
75+
### Query parameters
76+
To insert the API query parameters table of the `cat.indices` API, use the following snippet:
77+
```markdown
78+
<!-- spec_insert_start
79+
api: cat.indices
80+
component: query_parameters
81+
-->
82+
<!-- spec_insert_end -->
83+
```
84+
85+
This will insert the query parameters of the `cat.indices` API into the `.md` file with three default columns: `Parameter`, `Type`, and `Description`. You can customize the query parameters table by adding the `columns` argument which accepts a comma-separated list of column names. The available column names are:
86+
87+
- `Parameter`
88+
- `Type`
89+
- `Description`
90+
- `Required`
91+
- `Default`
92+
93+
_When `Required`/`Default` is not chosen, the information will be written in the `Description` column._
94+
95+
You can also customize this component with the following settings:
96+
97+
- `include_global` (Boolean; default is `false`): Includes global query parameters in the table.
98+
- `include_deprecated` (Boolean; default is `true`): Includes deprecated parameters in the table.
99+
- `pretty` (Boolean; default is `false`): Renders the table in the pretty format instead of the compact format.
100+
101+
The following snippet inserts the specified columns into the query parameters table:
102+
103+
```markdown
104+
<!-- spec_insert_start
105+
api: cat.indices
106+
component: query_parameters
107+
include_global: true
108+
include_deprecated: false
109+
pretty: true
110+
-->
111+
<!-- spec_insert_end -->
112+
```
113+
114+
### Path parameters
115+
To insert path parameters table of the `indices.create` API, use the following snippet:
116+
```markdown
117+
<!-- spec_insert_start
118+
api: indices.create
119+
component: path_parameters
120+
-->
121+
<!-- spec_insert_end -->
122+
```
123+
This table behaves the same as the query parameters table except that it does not accept the `include_global` argument.
124+
125+
### Paths and HTTP methods
126+
To insert paths and HTTP methods for the `search` API, use the following snippet:
127+
```markdown
128+
<!-- spec_insert_start
129+
api: search
130+
component: paths_and_http_methods
131+
-->
132+
<!-- spec_insert_end -->
133+
```

Gemfile

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
source "http://rubygems.org"
1+
# frozen_string_literal: true
2+
3+
source 'https://rubygems.org'
4+
5+
# Manually add csv gem since Ruby 3.4.0 no longer includes it
6+
gem 'csv', '~> 3.0'
27

38
# Hello! This is where you manage which Jekyll version is used to run.
49
# When you want to use a different version, change it below, save the
@@ -8,12 +13,12 @@ source "http://rubygems.org"
813
#
914
# This will help ensure the proper Jekyll version is running.
1015
# Happy Jekylling!
11-
gem "jekyll", "~> 4.3.2"
16+
gem 'jekyll', '~> 4.3.2'
1217

1318
# This is the default theme for new Jekyll sites. You may change this to anything you like.
14-
gem "just-the-docs", "~> 0.3.3"
15-
gem "jekyll-remote-theme", "~> 0.4"
16-
gem "jekyll-redirect-from", "~> 0.16"
19+
gem 'jekyll-redirect-from', '~> 0.16'
20+
gem 'jekyll-remote-theme', '~> 0.4'
21+
gem 'just-the-docs', '~> 0.3.3'
1722

1823
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
1924
# uncomment the line below. To upgrade, run `bundle update github-pages`.
@@ -22,21 +27,31 @@ gem "jekyll-redirect-from", "~> 0.16"
2227

2328
# If you have any plugins, put them here!
2429
group :jekyll_plugins do
25-
gem "jekyll-last-modified-at"
26-
gem "jekyll-sitemap"
30+
gem 'jekyll-last-modified-at'
31+
gem 'jekyll-sitemap'
32+
gem 'jekyll-spec-insert', :path => './spec-insert'
2733
end
2834

2935
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
30-
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
36+
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
3137

3238
# Performance-booster for watching directories on Windows
33-
gem "wdm", "~> 0.1.0" if Gem.win_platform?
39+
gem 'wdm', '~> 0.1.0' if Gem.win_platform?
3440

3541
# Installs webrick dependency for building locally
36-
gem "webrick", "~> 1.7"
37-
42+
gem 'webrick', '~> 1.7'
3843

3944
# Link checker
40-
gem "typhoeus"
41-
gem "ruby-link-checker"
42-
gem "ruby-enum"
45+
gem 'ruby-enum'
46+
gem 'ruby-link-checker'
47+
gem 'typhoeus'
48+
49+
# Spec Insert
50+
gem 'activesupport', '~> 7'
51+
gem 'mustache', '~> 1'
52+
53+
group :development, :test do
54+
gem 'rspec'
55+
gem 'rubocop', '~> 1.44', require: false
56+
gem 'rubocop-rake', require: false
57+
end

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# About the OpenSearch documentation repo
44

55
The `documentation-website` repository contains the user documentation for OpenSearch. You can find the rendered documentation at [opensearch.org/docs](https://opensearch.org/docs).
6+
The markdown files in this repository are rendered into HTML pages using [Jekyll](https://jekyllrb.com/). Check the [DEVELOPER_GUIDE](DEVELOPER_GUIDE.md) for more information about how to use Jekyll for this repository.
67

78

89
## Contributing

_aggregations/bucket/nested.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ GET logs/_search
9696
"aggregations" : {
9797
"pages" : {
9898
"doc_count" : 2,
99-
"min_price" : {
100-
"value" : 200.0
99+
"min_load_time" : {
100+
"value" : 200
101101
}
102102
}
103103
}

_analyzers/character-filters/html-character-filter.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
layout: default
3-
title: html_strip character filter
3+
title: HTML strip
44
parent: Character filters
55
nav_order: 100
66
---
77

8-
# `html_strip` character filter
8+
# HTML strip character filter
99

1010
The `html_strip` character filter removes HTML tags, such as `<div>`, `<p>`, and `<a>`, from the input text and renders plain text. The filter can be configured to preserve certain tags or decode specific HTML entities, such as `&nbsp;`, into spaces.
1111

_analyzers/language-analyzers.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)