Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b97b254678 | |||
| e2c6f4c8e9 | |||
| aa0c445b35 | |||
| 45e326a229 | |||
| f97666c92a | |||
| eb10960552 | |||
| 0cdee1b9f1 | |||
| 41c01358b9 | |||
| 23e4562f54 | |||
| b21bc57c19 | |||
| 907d8fa78c | |||
| ddcec72c2a |
+1
-1
@@ -1,7 +1,7 @@
|
||||
title: OpenSearch documentation
|
||||
description: >- # this means to ignore newlines until "baseurl:"
|
||||
Documentation for OpenSearch, the Apache 2.0 search, analytics, and visualization suite with advanced security, alerting, SQL support, automated index management, deep performance analysis, and more.
|
||||
baseurl: "/docs" # the subpath of your site, e.g. /blog
|
||||
baseurl: "/docs/latest" # the subpath of your site, e.g. /blog
|
||||
url: "https://opensearch.org" # the base hostname & protocol for your site, e.g. http://example.com
|
||||
permalink: /:path/
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ You can use composable index templates to overcome these challenges. Composable
|
||||
|
||||
You can combine component templates to compose an index template.
|
||||
|
||||
Settings and mappings that you specify directly in the [create index]({{site.url}}{{site.baseurl}}/opensearch/rest-api/create-index/) request override any settings or mappings specified in an index template and its component templates.
|
||||
Settings and mappings that you specify directly in the [create index]({{site.url}}{{site.baseurl}}/opensearch/rest-api/index-apis/create-index/) request override any settings or mappings specified in an index template and its component templates.
|
||||
{: .note }
|
||||
|
||||
### Create a component template
|
||||
|
||||
+44
-59
@@ -19,68 +19,53 @@ require "pathname"
|
||||
|
||||
module Jekyll::LinkChecker
|
||||
|
||||
##
|
||||
# The collection that will get stores as the output
|
||||
|
||||
@urls = {}
|
||||
|
||||
##
|
||||
# Pattern to identify documents that should be excluded based on their URL
|
||||
@excluded_paths = /(\.(css|js|json|map|xml|txt|yml)$|\/version-selector\.tpl$)/i.freeze
|
||||
|
||||
@excluded_paths = /(\.(css|js|json|map|xml|txt|yml)$)/i.freeze
|
||||
|
||||
##
|
||||
# Pattern to identify certain HTML tags whose content should be excluded from indexing
|
||||
|
||||
@href_matcher = /<a[^>]+href=(['"])(.+?)\1/im.freeze
|
||||
|
||||
##
|
||||
# Pattern to check for external URLs
|
||||
|
||||
@external_matcher = /^https?:\/\//.freeze
|
||||
|
||||
##
|
||||
# List of domains to ignore
|
||||
@ignored_domains = %w[localhost]
|
||||
|
||||
##
|
||||
# Pattern of local paths to ignore
|
||||
@ignored_paths = /(^\/javadocs\/)/.freeze
|
||||
|
||||
##
|
||||
# Pattern to exclude when adding the `index.html` suffix to paths
|
||||
@need_no_suffix = /\.(?!html)[^\/]+$/.freeze
|
||||
|
||||
# Valid response codes for successful links
|
||||
@success_codes = %w[200 302]
|
||||
|
||||
##
|
||||
# Questionable response codes for successful links
|
||||
@questionable_codes = %w[301 403 429]
|
||||
|
||||
##
|
||||
# Holds the list of failures
|
||||
@failures = []
|
||||
|
||||
##
|
||||
# Driven by environment variables, it indicates a need to check external links
|
||||
@check_external_links
|
||||
|
||||
##
|
||||
# Driven by environment variables, it indicates the need to fail the build for dead links
|
||||
@should_build_fatally
|
||||
|
||||
|
||||
##
|
||||
# Initializes the singleton by recording the site
|
||||
|
||||
# return [void]
|
||||
def self.init(site)
|
||||
@site = site
|
||||
@urls = {}
|
||||
@failures = []
|
||||
end
|
||||
|
||||
##
|
||||
# Processes a Document or Page and adds the links to a collection
|
||||
# It also checks for anchors to parts of the same page/doc
|
||||
|
||||
# It also checks for anchors that link to parts of the same page/doc
|
||||
# return [void]
|
||||
def self.process(page)
|
||||
return if @excluded_paths.match(page.path)
|
||||
|
||||
@@ -98,9 +83,8 @@ module Jekyll::LinkChecker
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# Saves the collection as a JSON file
|
||||
|
||||
# Verifies the validity of all the destinations gathered in @urls
|
||||
# return [void]
|
||||
def self.verify(site)
|
||||
if ENV.key?('JEKYLL_CHECK_EXTERNAL_LINKS')
|
||||
@check_external_links = true
|
||||
@@ -132,9 +116,9 @@ module Jekyll::LinkChecker
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# Check if URL is accessible
|
||||
|
||||
# Check if an internal or external URL is accessible
|
||||
# @param url [String] the url to check
|
||||
# @return [Boolean]
|
||||
def self.check(url)
|
||||
match = @base_url_matcher.match(url)
|
||||
unless match.nil?
|
||||
@@ -149,9 +133,9 @@ module Jekyll::LinkChecker
|
||||
return self.check_internal(url)
|
||||
end
|
||||
|
||||
##
|
||||
# Check if an external URL is accessible by making a HEAD call
|
||||
|
||||
# @param url [String] the url to check
|
||||
# @return [Boolean]
|
||||
def self.check_external(url)
|
||||
uri = URI(url)
|
||||
return true if @ignored_domains.include? uri.host
|
||||
@@ -172,61 +156,62 @@ module Jekyll::LinkChecker
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# Check if an internal link is accessible
|
||||
|
||||
# @param url [String] the url to check
|
||||
# @return [Boolean]
|
||||
def self.check_internal(url)
|
||||
return true if @ignored_paths =~ url
|
||||
|
||||
path, hash = url.split('#')
|
||||
|
||||
unless path.end_with? 'index.html'
|
||||
path << '/' unless path.end_with? '/'
|
||||
path << 'index.html' unless path.end_with? 'index.html'
|
||||
if @need_no_suffix =~ path
|
||||
filename = File.join(@site.config["destination"], path)
|
||||
return File.file?(filename)
|
||||
else
|
||||
unless path.end_with? 'index.html'
|
||||
path << '/' unless path.end_with? '/'
|
||||
path << 'index.html' unless path.end_with? 'index.html'
|
||||
end
|
||||
|
||||
filename = File.join(@site.config["destination"], path)
|
||||
|
||||
return false unless File.file?(filename)
|
||||
|
||||
content = File.read(filename)
|
||||
unless content.include? "<title>Redirecting"
|
||||
return true if hash.nil? || hash.empty?
|
||||
return !(content =~ /<[a-z0-9-]+[^>]+id="#{hash}"/i).nil?
|
||||
end
|
||||
|
||||
match = content.match(@href_matcher)
|
||||
if match.nil?
|
||||
puts "LinkChecker: [Warning] Cannot check #{url} due to an unfollowable redirect"
|
||||
return true
|
||||
end
|
||||
|
||||
redirect = match[2]
|
||||
redirect << '#' + hash unless hash.nil? || hash.empty?
|
||||
return self.check(redirect)
|
||||
end
|
||||
|
||||
filename = File.join(@site.config["destination"], path)
|
||||
|
||||
return false unless File.file?(filename)
|
||||
|
||||
content = File.read(filename)
|
||||
unless content.include? "<title>Redirecting"
|
||||
return true if hash.nil? || hash.empty?
|
||||
return !(content =~ /<[a-z0-9-]+[^>]+id="#{hash}"/i).nil?
|
||||
end
|
||||
|
||||
match = content.match(@href_matcher)
|
||||
if match.nil?
|
||||
puts "LinkChecker: [Warning] Cannot check #{url} due to an unfollowable redirect"
|
||||
return true
|
||||
end
|
||||
|
||||
redirect = match[2]
|
||||
redirect << '#' + hash unless hash.nil? || hash.empty?
|
||||
return self.check(redirect)
|
||||
end
|
||||
end
|
||||
|
||||
# Before any Document or Page is processed, initialize the LinkChecker
|
||||
|
||||
Jekyll::Hooks.register :site, :pre_render do |site|
|
||||
Jekyll::LinkChecker.init(site)
|
||||
end
|
||||
|
||||
# Process a Page as soon as its content is ready
|
||||
|
||||
Jekyll::Hooks.register :pages, :post_convert do |page|
|
||||
Jekyll::LinkChecker.process(page)
|
||||
end
|
||||
|
||||
# Process a Document as soon as its content is ready
|
||||
|
||||
Jekyll::Hooks.register :documents, :post_convert do |document|
|
||||
Jekyll::LinkChecker.process(document)
|
||||
end
|
||||
|
||||
# Verify gathered links after Jekyll is done writing all its stuff
|
||||
|
||||
Jekyll::Hooks.register :site, :post_write do |site|
|
||||
Jekyll::LinkChecker.verify(site)
|
||||
end
|
||||
@@ -16,6 +16,21 @@ This page contains a list of common issues and workarounds.
|
||||
If you encounter the error `FATAL Error: Request Timeout after 30000ms` during startup, try running OpenSearch Dashboards on a more powerful machine. We recommend four CPU cores and 8 GB of RAM.
|
||||
|
||||
|
||||
## Requests to OpenSearch Dashboards fail with "Request must contain a osd-xsrf header"
|
||||
|
||||
If you run legacy Kibana OSS scripts against OpenSearch Dashboards---for example, curl commands that import saved objects from a file---they might fail with the following error:
|
||||
|
||||
```json
|
||||
{"status": 400, "body": "Request must contain a osd-xsrf header."}
|
||||
```
|
||||
|
||||
In this case, your scripts likely include the `"kbn-xsrf: true"` header. Switch it to the `osd-xsrf: true` header:
|
||||
|
||||
```
|
||||
curl -XPOST -u 'admin:admin' 'https://DASHBOARDS_ENDPOINT/api/saved_objects/_import' -H 'osd-xsrf:true' --form file=@export.ndjson
|
||||
```
|
||||
|
||||
|
||||
## Multi-tenancy issues in OpenSearch Dashboards
|
||||
|
||||
If you're testing multiple users in OpenSearch Dashboards and encounter unexpected changes in tenant, use Google Chrome in an Incognito window or Firefox in a Private window.
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/* During build, DOC_VERSIONS is prefixed to convey all the versions available, informed by `_data/versions.json`
|
||||
* Example:
|
||||
* const DOC_VERSIONS = ["1.1","1.0"];
|
||||
*/
|
||||
const PREFIX = "OpenSearch ";
|
||||
const tpl = `
|
||||
<style>
|
||||
@@ -161,6 +165,16 @@ class VersionSelector extends HTMLElement {
|
||||
shadowRoot.querySelector('#root').addEventListener('click', e => {
|
||||
this._expand(this.getAttribute('aria-expanded') !== 'true');
|
||||
});
|
||||
|
||||
/* On some devices, `blur` is fired on the component before navigation occurs when choosing a version from the
|
||||
* dropdown; this ends up hiding the dropdown and preventing the navigation. The `pointerup` on the anchor
|
||||
* element is always fired before the `blur` is dispatched on the component and that is used here to trigger
|
||||
* the navigation before the dropdown is hidden.
|
||||
*/
|
||||
shadowRoot.querySelector('#dropdown').addEventListener('pointerup', e => {
|
||||
const {target} = e;
|
||||
if (target.matches('a[href]') && target.href) document.location.href = target.href;
|
||||
});
|
||||
}
|
||||
|
||||
_expand(flag) {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 307 KiB After Width: | Height: | Size: 267 KiB |
Reference in New Issue
Block a user