Specialized queries
This group contains queries which do not fit into the other groups:
distance_feature
query-
A query that computes scores based on the dynamically computed distances between the origin and documents' date, date_nanos and geo_point fields. It is able to efficiently skip non-competitive hits.
more_like_this
query-
This query finds documents which are similar to the specified text, document, or collection of documents.
percolate
query-
This query finds queries that are stored as documents that match with the specified document.
rank_feature
query-
A query that computes scores based on the values of numeric features and is able to efficiently skip non-competitive hits.
script
query-
This query allows a script to act as a filter. Also see the
function_score
query. script_score
query-
A query that allows to modify the score of a sub-query with a script.
wrapper
query-
A query that accepts other queries as json or yaml string.
Distance feature query
Boosts the relevance score of documents closer to a
provided origin
date or point. For example, you can use this query to give
more weight to documents closer to a certain date or location.
You can use the distance_feature
query to find the nearest neighbors to a
location. You can also use the query in a bool
search’s should
filter to add boosted relevance scores to the bool
query’s
scores.
Example request
Index setup
To use the distance_feature
query, your index must include a date
,
date_nanos
or geo_point
field.
To see how you can set up an index for the distance_feature
query, try the
following example.
-
Create an
items
index with the following field mapping: -
Index several documents to this index.
PUT /items/_doc/1?refresh { "name" : "chocolate", "production_date": "2018-02-01", "location": [-71.34, 41.12] } PUT /items/_doc/2?refresh { "name" : "chocolate", "production_date": "2018-01-01", "location": [-71.3, 41.15] } PUT /items/_doc/3?refresh { "name" : "chocolate", "production_date": "2017-12-01", "location": [-71.3, 41.12] }
Example queries
Boost documents based on date
The following bool
search returns documents with a name
value of
chocolate
. The search also uses the distance_feature
query to increase the
relevance score of documents with a production_date
value closer to now
.
GET /items/_search
{
"query": {
"bool": {
"must": {
"match": {
"name": "chocolate"
}
},
"should": {
"distance_feature": {
"field": "production_date",
"pivot": "7d",
"origin": "now"
}
}
}
}
}
Boost documents based on location
The following bool
search returns documents with a name
value of
chocolate
. The search also uses the distance_feature
query to increase the
relevance score of documents with a location
value closer to [-71.3, 41.15]
.
GET /items/_search
{
"query": {
"bool": {
"must": {
"match": {
"name": "chocolate"
}
},
"should": {
"distance_feature": {
"field": "location",
"pivot": "1000m",
"origin": [-71.3, 41.15]
}
}
}
}
}
Top-level parameters for distance_feature
field
-
(Required, string) Name of the field used to calculate distances. This field must meet the following criteria:
-
Be a
date
,date_nanos
orgeo_point
field -
Have an
index
mapping parameter value oftrue
, which is the default -
Have an
doc_values
mapping parameter value oftrue
, which is the default
-
origin
-
(Required, string) Date or point of origin used to calculate distances.
If the
field
value is adate
ordate_nanos
field, theorigin
value must be a date. Date Math, such asnow-1h
, is supported.If the
field
value is ageo_point
field, theorigin
value must be a geopoint. pivot
-
(Required, time unit or distance unit) Distance from the
origin
at which relevance scores receive half of theboost
value.If the
field
value is adate
ordate_nanos
field, thepivot
value must be a time unit, such as1h
or10d
.If the
field
value is ageo_point
field, thepivot
value must be a distance unit, such as1km
or12m
. boost
-
(Optional, float) Floating point number used to multiply the relevance score of matching documents. This value cannot be negative. Defaults to
1.0
.
Notes
How the distance_feature
query calculates relevance scores
The distance_feature
query dynamically calculates the distance between the
origin
value and a document’s field values. It then uses this distance as a
feature to boost the relevance score of closer
documents.
The distance_feature
query calculates a document’s
relevance score as follows:
relevance score = boost * pivot / (pivot + distance)
The distance
is the absolute difference between the origin
value and a
document’s field value.
Skip non-competitive hits
Unlike the function_score
query or other
ways to change relevance scores, the
distance_feature
query efficiently skips non-competitive hits when the
track_total_hits
parameter is not true
.
More like this query
The More Like This Query finds documents that are "like" a given set of documents. In order to do so, MLT selects a set of representative terms of these input documents, forms a query using these terms, executes the query and returns the results. The user controls the input documents, how the terms should be selected and how the query is formed.
The simplest use case consists of asking for documents that are similar to a provided piece of text. Here, we are asking for all movies that have some text similar to "Once upon a time" in their "title" and in their "description" fields, limiting the number of selected terms to 12.
GET /_search
{
"query": {
"more_like_this" : {
"fields" : ["title", "description"],
"like" : "Once upon a time",
"min_term_freq" : 1,
"max_query_terms" : 12
}
}
}
A more complicated use case consists of mixing texts with documents already existing in the index. In this case, the syntax to specify a document is similar to the one used in the Multi GET API.
GET /_search
{
"query": {
"more_like_this": {
"fields": [ "title", "description" ],
"like": [
{
"_index": "imdb",
"_id": "1"
},
{
"_index": "imdb",
"_id": "2"
},
"and potentially some more text here as well"
],
"min_term_freq": 1,
"max_query_terms": 12
}
}
}
Finally, users can mix some texts, a chosen set of documents but also provide documents not necessarily present in the index. To provide documents not present in the index, the syntax is similar to artificial documents.
GET /_search
{
"query": {
"more_like_this": {
"fields": [ "name.first", "name.last" ],
"like": [
{
"_index": "marvel",
"doc": {
"name": {
"first": "Ben",
"last": "Grimm"
},
"_doc": "You got no idea what I'd... what I'd give to be invisible."
}
},
{
"_index": "marvel",
"_id": "2"
}
],
"min_term_freq": 1,
"max_query_terms": 12
}
}
}
How it Works
Suppose we wanted to find all documents similar to a given input document.
Obviously, the input document itself should be its best match for that type of
query. And the reason would be mostly, according to
Lucene scoring formula,
due to the terms with the highest tf-idf. Therefore, the terms of the input
document that have the highest tf-idf are good representatives of that
document, and could be used within a disjunctive query (or OR
) to retrieve similar
documents. The MLT query simply extracts the text from the input document,
analyzes it, usually using the same analyzer at the field, then selects the
top K terms with highest tf-idf to form a disjunctive query of these terms.
|
Important
|
The fields on which to perform MLT must be indexed and of type
text or keyword` . Additionally, when using like with documents, either
_source must be enabled or the fields must be stored or store
term_vector . In order to speed up analysis, it could help to store term
vectors at index time.
|
For example, if we wish to perform MLT on the "title" and "tags.raw" fields,
we can explicitly store their term_vector
at index time. We can still
perform MLT on the "description" and "tags" fields, as _source
is enabled by
default, but there will be no speed up on analysis for these fields.
PUT /imdb
{
"mappings": {
"properties": {
"title": {
"type": "text",
"term_vector": "yes"
},
"description": {
"type": "text"
},
"tags": {
"type": "text",
"fields": {
"raw": {
"type": "text",
"analyzer": "keyword",
"term_vector": "yes"
}
}
}
}
}
}
Parameters
The only required parameter is like
, all other parameters have sensible
defaults. There are three types of parameters: one to specify the document
input, the other one for term selection and for query formation.
Document Input Parameters
like
|
The only required parameter of the MLT query is |
unlike
|
The |
fields
|
A list of fields to fetch and analyze the text from. |
Term Selection Parameters
max_query_terms
|
The maximum number of query terms that will be selected. Increasing this value
gives greater accuracy at the expense of query execution speed. Defaults to
|
min_term_freq
|
The minimum term frequency below which the terms will be ignored from the
input document. Defaults to |
min_doc_freq
|
The minimum document frequency below which the terms will be ignored from the
input document. Defaults to |
max_doc_freq
|
The maximum document frequency above which the terms will be ignored from the
input document. This could be useful in order to ignore highly frequent words
such as stop words. Defaults to unbounded ( |
min_word_length
|
The minimum word length below which the terms will be ignored. The old name
|
max_word_length
|
The maximum word length above which the terms will be ignored. The old name
|
stop_words
|
An array of stop words. Any word in this set is considered "uninteresting" and ignored. If the analyzer allows for stop words, you might want to tell MLT to explicitly ignore them, as for the purposes of document similarity it seems reasonable to assume that "a stop word is never interesting". |
analyzer
|
The analyzer that is used to analyze the free form text. Defaults to the
analyzer associated with the first field in |
Query Formation Parameters
minimum_should_match
|
After the disjunctive query has been formed, this parameter controls the
number of terms that must match.
The syntax is the same as the minimum should match.
(Defaults to |
fail_on_unsupported_field
|
Controls whether the query should fail (throw an exception) if any of the
specified fields are not of the supported types
( |
boost_terms
|
Each term in the formed query could be further boosted by their tf-idf score.
This sets the boost factor to use when using this feature. Defaults to
deactivated ( |
include
|
Specifies whether the input documents should also be included in the search
results returned. Defaults to |
boost
|
Sets the boost value of the whole query. Defaults to |
Alternative
To take more control over the construction of a query for similar documents it is worth considering writing custom client code to assemble selected terms from an example document into a Boolean query with the desired settings. The logic in more_like_this
that selects "interesting" words from a piece of text is also accessible via the TermVectors API. For example, using the termvectors API it would be possible to present users with a selection of topical keywords found in a document’s text, allowing them to select words of interest to drill down on, rather than using the more "black-box" approach of matching used by more_like_this
.
Percolate query
The percolate
query can be used to match queries
stored in an index. The percolate
query itself
contains the document that will be used as query
to match with the stored queries.
Sample Usage
Create an index with two fields:
PUT /my-index-00001
{
"mappings": {
"properties": {
"message": {
"type": "text"
},
"query": {
"type": "percolator"
}
}
}
}
The message
field is the field used to preprocess the document defined in
the percolator
query before it gets indexed into a temporary index.
The query
field is used for indexing the query documents. It will hold a
json object that represents an actual OpenSearch query. The query
field
has been configured to use the percolator field type. This field
type understands the query dsl and stores the query in such a way that it can be
used later on to match documents defined on the percolate
query.
Register a query in the percolator:
PUT /my-index-00001/_doc/1?refresh
{
"query": {
"match": {
"message": "bonsai tree"
}
}
}
Match a document to the registered percolator queries:
GET /my-index-00001/_search
{
"query": {
"percolate": {
"field": "query",
"document": {
"message": "A new bonsai tree in the office"
}
}
}
}
The above request will yield the following response:
{
"took": 13,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped" : 0,
"failed": 0
},
"hits": {
"total" : {
"value": 1,
"relation": "eq"
},
"max_score": 0.26152915,
"hits": [
{ (1)
"_index": "my-index-00001",
"_type": "_doc",
"_id": "1",
"_score": 0.26152915,
"_source": {
"query": {
"match": {
"message": "bonsai tree"
}
}
},
"fields" : {
"_percolator_document_slot" : [0] (2)
}
}
]
}
}
-
The query with id
1
matches our document. -
The
_percolator_document_slot
field indicates which document has matched with this query. Useful when percolating multiple document simultaneously.
|
Tip
|
To provide a simple example, this documentation uses one index my-index-00001 for both the percolate queries and documents.
This set-up can work well when there are just a few percolate queries registered. However, with heavier usage it is recommended
to store queries and documents in separate indices. Please see How it Works Under the Hood for more details.
|
Parameters
The following parameters are required when percolating a document:
field
|
The field of type |
name
|
The suffix to be used for the |
document
|
The source of the document being percolated. |
documents
|
Like the |
document_type
|
The type / mapping of the document being percolated. |
Instead of specifying the source of the document being percolated, the source can also be retrieved from an already
stored document. The percolate
query will then internally execute a get request to fetch that document.
In that case the document
parameter can be substituted with the following parameters:
index
|
The index the document resides in. This is a required parameter. |
type
|
The type of the document to fetch. |
id
|
The id of the document to fetch. This is a required parameter. |
routing
|
Optionally, routing to be used to fetch document to percolate. |
preference
|
Optionally, preference to be used to fetch document to percolate. |
version
|
Optionally, the expected version of the document to be fetched. |
Percolating in a filter context
In case you are not interested in the score, better performance can be expected by wrapping
the percolator query in a bool
query’s filter clause or in a constant_score
query:
GET /my-index-00001/_search
{
"query": {
"constant_score": {
"filter": {
"percolate": {
"field": "query",
"document": {
"message": "A new bonsai tree in the office"
}
}
}
}
}
}
At index time terms are extracted from the percolator query and the percolator
can often determine whether a query matches just by looking at those extracted
terms. However, computing scores requires to deserialize each matching query
and run it against the percolated document, which is a much more expensive
operation. Hence if computing scores is not required the percolate
query
should be wrapped in a constant_score
query or a bool
query’s filter clause.
Note that the percolate
query never gets cached by the query cache.
Percolating multiple documents
The percolate
query can match multiple documents simultaneously with the indexed percolator queries.
Percolating multiple documents in a single request can improve performance as queries only need to be parsed and
matched once instead of multiple times.
The _percolator_document_slot
field that is being returned with each matched percolator query is important when percolating
multiple documents simultaneously. It indicates which documents matched with a particular percolator query. The numbers
correlate with the slot in the documents
array specified in the percolate
query.
GET /my-index-00001/_search
{
"query": {
"percolate": {
"field": "query",
"documents": [ (1)
{
"message": "bonsai tree"
},
{
"message": "new tree"
},
{
"message": "the office"
},
{
"message": "office tree"
}
]
}
}
}
-
The documents array contains 4 documents that are going to be percolated at the same time.
{
"took": 13,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped" : 0,
"failed": 0
},
"hits": {
"total" : {
"value": 1,
"relation": "eq"
},
"max_score": 0.7093853,
"hits": [
{
"_index": "my-index-00001",
"_type": "_doc",
"_id": "1",
"_score": 0.7093853,
"_source": {
"query": {
"match": {
"message": "bonsai tree"
}
}
},
"fields" : {
"_percolator_document_slot" : [0, 1, 3] (1)
}
}
]
}
}
-
The
_percolator_document_slot
indicates that the first, second and last documents specified in thepercolate
query are matching with this query.
Percolating an Existing Document
In order to percolate a newly indexed document, the percolate
query can be used. Based on the response
from an index request, the _id
and other meta information can be used to immediately percolate the newly added
document.
Example
Based on the previous example.
Index the document we want to percolate:
PUT /my-index-00001/_doc/2
{
"message" : "A new bonsai tree in the office"
}
Index response:
{
"_index": "my-index-00001",
"_type": "_doc",
"_id": "2",
"_version": 1,
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"result": "created",
"_seq_no" : 1,
"_primary_term" : 1
}
Percolating an existing document, using the index response as basis to build to new search request:
GET /my-index-00001/_search
{
"query": {
"percolate": {
"field": "query",
"index": "my-index-00001",
"id": "2",
"version": 1 (1)
}
}
}
-
The version is optional, but useful in certain cases. We can ensure that we are trying to percolate the document we just have indexed. A change may be made after we have indexed, and if that is the case the search request would fail with a version conflict error.
The search response returned is identical as in the previous example.
Percolate query and highlighting
The percolate
query is handled in a special way when it comes to highlighting. The queries hits are used
to highlight the document that is provided in the percolate
query. Whereas with regular highlighting the query in
the search request is used to highlight the hits.
Example
This example is based on the mapping of the first example.
Save a query:
PUT /my-index-00001/_doc/3?refresh
{
"query": {
"match": {
"message": "brown fox"
}
}
}
Save another query:
PUT /my-index-00001/_doc/4?refresh
{
"query": {
"match": {
"message": "lazy dog"
}
}
}
Execute a search request with the percolate
query and highlighting enabled:
GET /my-index-00001/_search
{
"query": {
"percolate": {
"field": "query",
"document": {
"message": "The quick brown fox jumps over the lazy dog"
}
}
},
"highlight": {
"fields": {
"message": {}
}
}
}
This will yield the following response.
{
"took": 7,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped" : 0,
"failed": 0
},
"hits": {
"total" : {
"value": 2,
"relation": "eq"
},
"max_score": 0.26152915,
"hits": [
{
"_index": "my-index-00001",
"_type": "_doc",
"_id": "3",
"_score": 0.26152915,
"_source": {
"query": {
"match": {
"message": "brown fox"
}
}
},
"highlight": {
"message": [
"The quick brown fox jumps over the lazy dog" (1)
]
},
"fields" : {
"_percolator_document_slot" : [0]
}
},
{
"_index": "my-index-00001",
"_type": "_doc",
"_id": "4",
"_score": 0.26152915,
"_source": {
"query": {
"match": {
"message": "lazy dog"
}
}
},
"highlight": {
"message": [
"The quick brown fox jumps over the lazy dog" (1)
]
},
"fields" : {
"_percolator_document_slot" : [0]
}
}
]
}
}
-
The terms from each query have been highlighted in the document.
Instead of the query in the search request highlighting the percolator hits, the percolator queries are highlighting
the document defined in the percolate
query.
When percolating multiple documents at the same time like the request below then the highlight response is different:
GET /my-index-00001/_search
{
"query": {
"percolate": {
"field": "query",
"documents": [
{
"message": "bonsai tree"
},
{
"message": "new tree"
},
{
"message": "the office"
},
{
"message": "office tree"
}
]
}
},
"highlight": {
"fields": {
"message": {}
}
}
}
The slightly different response:
{
"took": 13,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped" : 0,
"failed": 0
},
"hits": {
"total" : {
"value": 1,
"relation": "eq"
},
"max_score": 0.7093853,
"hits": [
{
"_index": "my-index-00001",
"_type": "_doc",
"_id": "1",
"_score": 0.7093853,
"_source": {
"query": {
"match": {
"message": "bonsai tree"
}
}
},
"fields" : {
"_percolator_document_slot" : [0, 1, 3]
},
"highlight" : { (1)
"0_message" : [
"bonsai tree"
],
"3_message" : [
"office tree"
],
"1_message" : [
"new tree"
]
}
}
]
}
}
-
The highlight fields have been prefixed with the document slot they belong to, in order to know which highlight field belongs to what document.
Specifying multiple percolate queries
It is possible to specify multiple percolate
queries in a single search request:
GET /my-index-00001/_search
{
"query": {
"bool": {
"should": [
{
"percolate": {
"field": "query",
"document": {
"message": "bonsai tree"
},
"name": "query1" (1)
}
},
{
"percolate": {
"field": "query",
"document": {
"message": "tulip flower"
},
"name": "query2" (1)
}
}
]
}
}
}
-
The
name
parameter will be used to identify which percolator document slots belong to whatpercolate
query.
The _percolator_document_slot
field name will be suffixed with what is specified in the _name
parameter.
If that isn’t specified then the field
parameter will be used, which in this case will result in ambiguity.
The above search request returns a response similar to this:
{
"took": 13,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped" : 0,
"failed": 0
},
"hits": {
"total" : {
"value": 1,
"relation": "eq"
},
"max_score": 0.26152915,
"hits": [
{
"_index": "my-index-00001",
"_type": "_doc",
"_id": "1",
"_score": 0.26152915,
"_source": {
"query": {
"match": {
"message": "bonsai tree"
}
}
},
"fields" : {
"_percolator_document_slot_query1" : [0] (1)
}
}
]
}
}
-
The
_percolator_document_slot_query1
percolator slot field indicates that these matched slots are from thepercolate
query with_name
parameter set toquery1
.
How it Works Under the Hood
When indexing a document into an index that has the percolator field type mapping configured, the query part of the document gets parsed into a Lucene query and is stored into the Lucene index. A binary representation of the query gets stored, but also the query’s terms are analyzed and stored into an indexed field.
At search time, the document specified in the request gets parsed into a Lucene document and is stored in a in-memory temporary Lucene index. This in-memory index can just hold this one document and it is optimized for that. After this a special query is built based on the terms in the in-memory index that select candidate percolator queries based on their indexed query terms. These queries are then evaluated by the in-memory index if they actually match.
The selecting of candidate percolator queries matches is an important performance optimization during the execution
of the percolate
query as it can significantly reduce the number of candidate matches the in-memory index needs to
evaluate. The reason the percolate
query can do this is because during indexing of the percolator queries the query
terms are being extracted and indexed with the percolator query. Unfortunately the percolator cannot extract terms from
all queries (for example the wildcard
or geo_shape
query) and as a result of that in certain cases the percolator
can’t do the selecting optimization (for example if an unsupported query is defined in a required clause of a boolean query
or the unsupported query is the only query in the percolator document). These queries are marked by the percolator and
can be found by running the following search:
GET /_search
{
"query": {
"term" : {
"query.extraction_result" : "failed"
}
}
}
|
Note
|
The above example assumes that there is a query field of type
percolator in the mappings.
|
Given the design of percolation, it often makes sense to use separate indices for the percolate queries and documents being percolated, as opposed to a single index as we do in examples. There are a few benefits to this approach:
-
Because percolate queries contain a different set of fields from the percolated documents, using two separate indices allows for fields to be stored in a denser, more efficient way.
-
Percolate queries do not scale in the same way as other queries, so percolation performance may benefit from using a different index configuration, like the number of primary shards.
Notes
Allow expensive queries
Percolate queries will not be executed if search.allow_expensive_queries
is set to false.
Rank feature query
Boosts the relevance score of documents based on the
numeric value of a rank_feature
or
rank_features
field.
The rank_feature
query is typically used in the should
clause of a
bool
query so its relevance scores are added to other
scores from the bool
query.
Unlike the function_score
query or other
ways to change relevance scores, the
rank_feature
query efficiently skips non-competitive hits when the
track_total_hits
parameter is not true
. This can
dramatically improve query speed.
Rank feature functions
To calculate relevance scores based on rank feature fields, the rank_feature
query supports the following mathematical functions:
If you don’t know where to start, we recommend using the saturation
function.
If no function is provided, the rank_feature
query uses the saturation
function by default.
Example request
Index setup
To use the rank_feature
query, your index must include a
rank_feature
or rank_features
field
mapping. To see how you can set up an index for the rank_feature
query, try
the following example.
Create a test
index with the following field mappings:
-
pagerank
, arank_feature
field which measures the importance of a website -
url_length
, arank_feature
field which contains the length of the website’s URL. For this example, a long URL correlates negatively to relevance, indicated by apositive_score_impact
value offalse
. -
topics
, arank_features
field which contains a list of topics and a measure of how well each document is connected to this topic
PUT /test
{
"mappings": {
"properties": {
"pagerank": {
"type": "rank_feature"
},
"url_length": {
"type": "rank_feature",
"positive_score_impact": false
},
"topics": {
"type": "rank_features"
}
}
}
}
Index several documents to the test
index.
PUT /test/_doc/1?refresh
{
"url": "https://en.wikipedia.org/wiki/2016_Summer_Olympics",
"content": "Rio 2016",
"pagerank": 50.3,
"url_length": 42,
"topics": {
"sports": 50,
"brazil": 30
}
}
PUT /test/_doc/2?refresh
{
"url": "https://en.wikipedia.org/wiki/2016_Brazilian_Grand_Prix",
"content": "Formula One motor race held on 13 November 2016",
"pagerank": 50.3,
"url_length": 47,
"topics": {
"sports": 35,
"formula one": 65,
"brazil": 20
}
}
PUT /test/_doc/3?refresh
{
"url": "https://en.wikipedia.org/wiki/Deadpool_(film)",
"content": "Deadpool is a 2016 American superhero film",
"pagerank": 50.3,
"url_length": 37,
"topics": {
"movies": 60,
"super hero": 65
}
}
Example query
The following query searches for 2016
and boosts relevance scores based on
pagerank
, url_length
, and the sports
topic.
GET /test/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"content": "2016"
}
}
],
"should": [
{
"rank_feature": {
"field": "pagerank"
}
},
{
"rank_feature": {
"field": "url_length",
"boost": 0.1
}
},
{
"rank_feature": {
"field": "topics.sports",
"boost": 0.4
}
}
]
}
}
}
Top-level parameters for rank_feature
field
-
(Required, string)
rank_feature
orrank_features
field used to boost relevance scores. boost
-
(Optional, float) Floating point number used to decrease or increase relevance scores. Defaults to
1.0
.Boost values are relative to the default value of
1.0
. A boost value between0
and1.0
decreases the relevance score. A value greater than1.0
increases the relevance score. saturation
-
(Optional, function object) Saturation function used to boost relevance scores based on the value of the rank feature
field
. If no function is provided, therank_feature
query defaults to thesaturation
function. See Saturation for more information.Only one function
saturation
,log
, orsigmoid
can be provided. log
-
(Optional, function object) Logarithmic function used to boost relevance scores based on the value of the rank feature
field
. See Logarithm for more information.Only one function
saturation
,log
, orsigmoid
can be provided. sigmoid
-
(Optional, function object) Sigmoid function used to boost relevance scores based on the value of the rank feature
field
. See Sigmoid for more information.Only one function
saturation
,log
, orsigmoid
can be provided.
Notes
Saturation
The saturation
function gives a score equal to S / (S + pivot)
, where S
is
the value of the rank feature field and pivot
is a configurable pivot value so
that the result will be less than 0.5
if S
is less than pivot and greater
than 0.5
otherwise. Scores are always (0,1)
.
If the rank feature has a negative score impact then the function will be
computed as pivot / (S + pivot)
, which decreases when S
increases.
GET /test/_search
{
"query": {
"rank_feature": {
"field": "pagerank",
"saturation": {
"pivot": 8
}
}
}
}
If a pivot
value is not provided, OpenSearch computes a default value equal to the
approximate geometric mean of all rank feature values in the index. We recommend
using this default value if you haven’t had the opportunity to train a good
pivot value.
GET /test/_search
{
"query": {
"rank_feature": {
"field": "pagerank",
"saturation": {}
}
}
}
Logarithm
The log
function gives a score equal to log(scaling_factor + S)
, where S
is the value of the rank feature field and scaling_factor
is a configurable
scaling factor. Scores are unbounded.
This function only supports rank features that have a positive score impact.
GET /test/_search
{
"query": {
"rank_feature": {
"field": "pagerank",
"log": {
"scaling_factor": 4
}
}
}
}
Sigmoid
The sigmoid
function is an extension of saturation
which adds a configurable
exponent. Scores are computed as Sexp / (Sexp + pivotexp)
. Like for the
saturation
function, pivot
is the value of S
that gives a score of 0.5
and scores are (0,1)
.
The exponent
must be positive and is typically in [0.5, 1]
. A
good value should be computed via training. If you don’t have the opportunity to
do so, we recommend you use the saturation
function instead.
GET /test/_search
{
"query": {
"rank_feature": {
"field": "pagerank",
"sigmoid": {
"pivot": 7,
"exponent": 0.6
}
}
}
}
Script query
Filters documents based on a provided script. The
script
query is typically used in a filter context.
|
Warning
|
Using scripts can result in slower search speeds. See Scripts and search speed. |
Example request
GET /_search
{
"query": {
"bool": {
"filter": {
"script": {
"script": {
"source": "doc['num1'].value > 1",
"lang": "painless"
}
}
}
}
}
}
Top-level parameters for script
script
-
(Required, script object) Contains a script to run as a query. This script must return a boolean value,
true
orfalse
.
Notes
Custom Parameters
Like filters, scripts are cached for faster execution.
If you frequently change the arguments of a script, we recommend you store them
in the script’s params
parameter. For example:
GET /_search
{
"query": {
"bool": {
"filter": {
"script": {
"script": {
"source": "doc['num1'].value > params.param1",
"lang": "painless",
"params": {
"param1": 5
}
}
}
}
}
}
}
Allow expensive queries
Script queries will not be executed if search.allow_expensive_queries
is set to false.
Script score query
Uses a script to provide a custom score for returned documents.
The script_score
query is useful if, for example, a scoring function is expensive and you only need to calculate the score of a filtered set of documents.
Example request
The following script_score
query assigns each returned document a score equal to the my-int
field value divided by 10
.
GET /_search
{
"query": {
"script_score": {
"query": {
"match": { "message": "opensearch" }
},
"script": {
"source": "doc['my-int'].value / 10 "
}
}
}
}
Top-level parameters for script_score
query
-
(Required, query object) Query used to return documents.
script
-
(Required, script object) Script used to compute the score of documents returned by the
query
.ImportantFinal relevance scores from the script_score
query cannot be negative. To support certain search optimizations, Lucene requires scores be positive or0
. min_score
-
(Optional, float) Documents with a score lower than this floating point number are excluded from the search results.
boost
-
(Optional, float) Documents' scores produced by
script
are multiplied byboost
to produce final documents' scores. Defaults to1.0
.
Notes
Use relevance scores in a script
Within a script, you can
access
the _score
variable which represents the current relevance score of a
document.
Predefined functions
You can use any of the available painless
functions in your script
. You can also use the following predefined functions
to customize scoring:
We suggest using these predefined functions instead of writing your own. These functions take advantage of efficiencies from OpenSearch' internal mechanisms.
Saturation
saturation(value,k) = value/(k + value)
"script" : {
"source" : "saturation(doc['my-int'].value, 1)"
}
Sigmoid
sigmoid(value, k, a) = value^a/ (k^a + value^a)
"script" : {
"source" : "sigmoid(doc['my-int'].value, 2, 1)"
}
Random score function
random_score
function generates scores that are uniformly distributed
from 0 up to but not including 1.
randomScore
function has the following syntax:
randomScore(<seed>, <fieldName>)
.
It has a required parameter - seed
as an integer value,
and an optional parameter - fieldName
as a string value.
"script" : {
"source" : "randomScore(100, '_seq_no')"
}
If the fieldName
parameter is omitted, the internal Lucene
document ids will be used as a source of randomness. This is very efficient,
but unfortunately not reproducible since documents might be renumbered
by merges.
"script" : {
"source" : "randomScore(100)"
}
Note that documents that are within the same shard and have the
same value for field will get the same score, so it is usually desirable
to use a field that has unique values for all documents across a shard.
A good default choice might be to use the _seq_no
field, whose only drawback is that scores will change if the document is
updated since update operations also update the value of the _seq_no
field.
Decay functions for numeric fields
You can read more about decay functions here.
-
double decayNumericLinear(double origin, double scale, double offset, double decay, double docValue)
-
double decayNumericExp(double origin, double scale, double offset, double decay, double docValue)
-
double decayNumericGauss(double origin, double scale, double offset, double decay, double docValue)
"script" : {
"source" : "decayNumericLinear(params.origin, params.scale, params.offset, params.decay, doc['dval'].value)",
"params": { (1)
"origin": 20,
"scale": 10,
"decay" : 0.5,
"offset" : 0
}
}
-
Using
params
allows to compile the script only once, even if params change.
Decay functions for geo fields
-
double decayGeoLinear(String originStr, String scaleStr, String offsetStr, double decay, GeoPoint docValue)
-
double decayGeoExp(String originStr, String scaleStr, String offsetStr, double decay, GeoPoint docValue)
-
double decayGeoGauss(String originStr, String scaleStr, String offsetStr, double decay, GeoPoint docValue)
"script" : {
"source" : "decayGeoExp(params.origin, params.scale, params.offset, params.decay, doc['location'].value)",
"params": {
"origin": "40, -70.12",
"scale": "200km",
"offset": "0km",
"decay" : 0.2
}
}
Decay functions for date fields
-
double decayDateLinear(String originStr, String scaleStr, String offsetStr, double decay, JodaCompatibleZonedDateTime docValueDate)
-
double decayDateExp(String originStr, String scaleStr, String offsetStr, double decay, JodaCompatibleZonedDateTime docValueDate)
-
double decayDateGauss(String originStr, String scaleStr, String offsetStr, double decay, JodaCompatibleZonedDateTime docValueDate)
"script" : {
"source" : "decayDateGauss(params.origin, params.scale, params.offset, params.decay, doc['date'].value)",
"params": {
"origin": "2008-01-01T01:00:00Z",
"scale": "1h",
"offset" : "0",
"decay" : 0.5
}
}
|
Note
|
Decay functions on dates are limited to dates in the default format
and default time zone. Also calculations with now are not supported.
|
Allow expensive queries
Script score queries will not be executed if search.allow_expensive_queries
is set to false.
Faster alternatives
The script_score
query calculates the score for
every matching document, or hit. There are faster alternative query types that
can efficiently skip non-competitive hits:
-
If you want to boost documents on some static fields, use the
rank_feature
query. -
If you want to boost documents closer to a date or geographic point, use the
distance_feature
query.
Transition from the function score query
We are deprecating the function_score
query. We recommend using the script_score
query instead.
You can implement the following functions from the function_score
query using
the script_score
query:
script_score
What you used in script_score
of the Function Score query, you
can copy into the Script Score query. No changes here.
weight
weight
function can be implemented in the Script Score query through
the following script:
"script" : {
"source" : "params.weight * _score",
"params": {
"weight": 2
}
}
random_score
Use randomScore
function
as described in random score function.
field_value_factor
field_value_factor
function can be easily implemented through script:
"script" : {
"source" : "Math.log10(doc['field'].value * params.factor)",
"params" : {
"factor" : 5
}
}
For checking if a document has a missing value, you can use
doc['field'].size() == 0
. For example, this script will use
a value 1
if a document doesn’t have a field field
:
"script" : {
"source" : "Math.log10((doc['field'].size() == 0 ? 1 : doc['field'].value()) * params.factor)",
"params" : {
"factor" : 5
}
}
This table lists how field_value_factor
modifiers can be implemented
through a script:
| Modifier | Implementation in Script Score |
|---|---|
|
- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
decay
functions
The script_score
query has equivalent decay functions
that can be used in script.
Explain request
Using an explain request provides an explanation of how the parts of a score were computed. The script_score
query can add its own explanation by setting the explanation
parameter:
GET /my-index-000001/_explain/0
{
"query": {
"script_score": {
"query": {
"match": { "message": "opensearch" }
},
"script": {
"source": """
long count = doc['count'].value;
double normalizedCount = count / 10;
if (explanation != null) {
explanation.set('normalized count = count / 10 = ' + count + ' / 10 = ' + normalizedCount);
}
return normalizedCount;
"""
}
}
}
}
Note that the explanation
will be null when using in a normal _search
request, so having a conditional guard is best practice.
Wrapper query
A query that accepts any other query as base64 encoded string.
GET /_search
{
"query": {
"wrapper": {
"query": "eyJ0ZXJtIiA6IHsgInVzZXIuaWQiIDogImtpbWNoeSIgfX0=" (1)
}
}
}
-
Base64 encoded string:
{"term" : { "user.id" : "bilbo" }}
This query is more useful in the context of the Java high-level REST client or transport client to also accept queries as json formatted string. In these cases queries can be specified as a json or yaml formatted string or as a query builder (which is a available in the Java high-level REST client).


Back
Configurator
Information
In order to preview the example, make sure that the "Sass Material" theme is selected from the "Change Theme" menu in the top-right corner of the demo page.
Ripple on Buttons
Default Button
Primary Button
Ripple on Checkboxes
Checkbox 1
Checkbox 2
Checkbox 3
Ripple on Radio Buttons
Radio 1
Radio 2
Radio 3
Ripple on List Items
Steven White
Nancy King
Nancy Davolio
Robert Davolio
Michael Leverling
Andrew Callahan
Michael Suyama


Zakariya Olakunle Taofik, fondly known as Pzak, is a dynamic preacher and teacher of the gospel of the Kingdom. You will not have to meet him a second time to notice his passion for revival and his commitment to making God real on the face of the earth.
He is an exceptionally gifted teacher of the word. Fully given to the work of the Lord and as the Spirit leads, he teaches, preaches, prophesies, heals, works miracles – whatever the Lord wants to do – for the manifestation of His Glory and the equipping of the saints.
Pzak mentors many, both young and old. He is one of the most friendly and fun-to-be-with-pastors you will ever meet with a peculiar anointing for encouraging and empowering people to live for God. He has ministered and continues to minister in several campuses and conferences around the country.
He is currently the president of the Glory Realms Ministries and the Senior Pastor of the Glory Centre Community Church – a growing community of believers that has been enforcing the will of God and kingdom culture in the city and its environs.
He is married to the love of his youth, the beautiful and graceful Adesola Zakariya. They are blessed with Maverick and Godiya.


I have been steadily developing an interest in entheogenic and psychoactive matter growing 'wildly' within my country (New Zealand), so I was most happy to find that Fly Agaric (Amanita Muscaria var. Muscaria) mushrooms were in fact endowed with hallucinogenic properties. I had been told as a child that they were deadly poisonous, and I think most people here have heard the same, the result being a generous proliferation of unpicked specimens.
A friend and I went to the local reserve and picked about 10 or 11 generous sized caps, wanting to start with a small dosage, and then increase it dependent on results. We cut out the gills, and dried the mushrooms in an oven, pouring the juice back over the 'shrooms (as recommended by Petri?). We ended up with around 11 grams of dried mushroom, which we added to the top of a small pesto/pasta meal we cooked to prepare our stomachs. I think the meal may have been a bad idea.
At 6:30pm we had approximately 3.5g of mushroom each (three people), and settled back, waiting for effects, aware they were likely to be minor. An hour later we hadn't felt a thing, and were skeptical of anything happening. 2 hours later and more of the same. We decided that we'd smoke a J since we were getting bored, and we did notice that we felt a little 'more than stoned'. At around 10:45pm I felt a very fleeting, yet distinct, 'size distortion' while standing in the kitchen, and one of my friends commented that she did aswell. We had another smoke, still feeling 'more than stoned', or perhaps just an augmented stone, and planned our next foray into the park.
I've gathered more now, and I'm going to try the next dosage at 6gms with no meal. I'm unsure whether we dried the mushrooms too much, whether we are at a late point in the season, or whether it was just a combination of low dosage and too much food - but at least we know they aren't 'deadly poisonous'. I'll keep you informed.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Portfolio
Github
Contact
Brandon Norsworthy
This is a headshot of myself, though its just a placeholder now
First name:
Last name:


{% extends "./wrapper.html" %} {% load actionkit_tags %} {% block content %}
Product Total {{ page.currency_sym }}
{{ candidate.desc }}
For political donations, we're required to ask for your employer and occupation:
JavaScript is required so this page can securely submit your donation.


Home > JavaScript Questions > Difference between “var” and “let” Keywords?
In javascript, var and let both are used for variable declaration but the difference between them is that var has function level scope and let has block level scope. var was there from the beginning but, let was introduced in ES2015/ES6.
Input:
// calling var x after definition
var x = 19;
document.write(x, "\n");
// calling var z before definition will return undefined
document.write(z, "\n");
var z = 23;
// calling let y after definition
let y = 15;
document.write(y, "\n");
// calling let a before definition will give error
document.write(a);
let a = 6;
Output:
19 undefined 15 error


Android Application for Weather Forecast.
Responsive Wordpress Custom theme for an Odontology Center which provides Services for general public and Courses for dentists
CaseLink: Cifaib
Responsive Wordpress theme for an amateur soccer association which promotes community integration through sports and benneficient events in Sao Paulo - Brazil. There are strategic advertisement places on the website, optimized for google Adsense ads. The Wordpress theme was made using Bootstrap and is optimized for mobile devices.
Link: AZON Website
Responsive Website and Wordpress theme development for ARTFLEX EVENTOS, a romantic luxury services company based in São Paulo - Brazil. Helicopter flights above the city, particular driver, special restaurant dinner, luxury hotels, personal driver, wedding proposals, pilot day and more.
Link: Artflex Eventos Website


- The largest array has a "Retained Size" of 55,580 bytes.
- It has 1000 elements, but when I scroll to the bottom of its elements, it says "Show all 903" elements,
which would imply this number does not include the already displayed values, so, there were 97 elements
displayed by default.
- Each element must be using about 58 bytes.
- Nested arrays have a length of 1 or 10, and . That is 10 bytes per element. Their "Retained Size" values are:
- 140 for 1 object
- 68 for ten null or undefined values
- 16 for ten true or false values
- 16 for ten short strings
- 16 for ten long strings
- I guess this means we cannot garbage collect true values, false values and strings.
- A 101 characters long string has a "Shallow Size" and "Retained Size" of 116.
- A 12 characters long string has a "Shallow Size" and "Retained Size" of 24.
- Nested object with one single element have a "Retained Size" of 84 bytes. My guess is 44 from system / Odball and 40 from something inside system / Map.
- bar has a "Retained Size" of 308.
- baz and buz have "Retained Size" of 104, somehow, referencing a shared object makes them lose 204 bytes compared to bar.


This lesson is using JavaScript hash based navigation. i.e the image that is displayed is based on the number after the hash in the url. View the source code of the page and look at the source of 'image.js' which contains the code for navigation.
Any value that you will supply in the url after the hash will be concatenated with the img tag and the new tag is placed inside the div. You can inject a DOM element of your own by crafting the url. For example : 3.jpg'/><img src=x onerror=alert(1)> will append another img tag by which an arbitary JavaScript code can be executed.


-
Version 0.0.4:
- Merge sshtoggled daemon with tweak
-
Version 0.0.3:
- Added release script
- Updated tweak & daemon versions
-
Version 0.0.2:
- Added daemon to toggle ssh
-
Version 0.0.1:
- Initialized tweak
- SSH toggle button in settings
- sshd load


Current Energy:
Blocks Left:
You have 20 points of energy to go 7 blocks to get to the concert. You'll have to stop and get food and drinks to keep your energy up along the way. Different foods and drinks adjust your energy level differently. It requires 4 points of energy to move up one block. Keep in mind that each turn moves you one block.
Think you can make it??
Before we get going, let's get someting in our bellys. Here's a cafe we can visit.
Select one item from each list and click 'Select' to move on to the next block.
Reminder: You lose 4 energy each time you move a block.
A bar!!! Let's get a small bite and a drink, shall we?
Burrito time!!!!
Looks like we've stumbled upon a craft beer fest with some food trucks. Our lucky day!!
Getting closer. Let's hit up another bar.
Sixth Move
Seventh Move
Congratulations!!! You made it!!
Congratulations!!!  You surely are not Batman....


Upload a 20 second wav audio for your breath. Sound should be as clear as possible to have the most accurate result.
{{result}}


9
The Destruction of Israel
1 I saw the LORD standing beside the altar, and he said:
“Strike the capitals until the thresholds shake,
and shatter them on the heads of all the people;
and those who are left of them I will kill with the sword;
not one of them shall flee away;
not one of them shall escape.
2 “If they dig into Sheol,
from there shall my hand take them;
if they climb up to heaven,
from there I will bring them down.
3 If they hide themselves on the top of Carmel,
from there I will search them out and take them;
and if they hide from my sight at the bottom of the sea,
there I will command the serpent, and it shall bite them.
4 And if they go into captivity before their enemies,
there I will command the sword, and it shall kill them;
and I will fix my eyes upon them
for evil and not for good.”
5 The Lord GOD of hosts,
he who touches the earth and it melts,
and all who dwell in it mourn,
and all of it rises like the Nile,
and sinks again, like the Nile of Egypt;
6 who builds his upper chambers in the heavens
and founds his vault upon the earth;
who calls for the waters of the sea
and pours them out upon the surface of the earth—
the LORD is his name.
7 “Are you not like the Cushites to me,
O people of Israel?” declares the LORD.

The Restoration of Israel
11 “In that day I will raise up
the booth of David that is fallen
and repair its breaches,
and raise up its ruins
and rebuild it as in the days of old,
12 that they may possess the remnant of Edom
and all the nations who are called by my name,”
declares the LORD who does this.
13 “Behold, the days are coming,” declares the LORD,
“when the plowman shall overtake the reaper
and the treader of grapes him who sows the seed;
the mountains shall drip sweet wine,
and all the hills shall flow with it.
14 I will restore the fortunes of my people Israel,
and they shall rebuild the ruined cities and inhabit them;
they shall plant vineyards and drink their wine,
and they shall make gardens and eat their fruit.
15 I will plant them on their land,
and they shall never again be uprooted
out of the land that I have given them,”
says the LORD your God.


Preparation time
less than 30 mins
Cooking time
1 to 2 hours
Serves
Serves 6
Dhansak is a popular Indian curry made from meat, lentils and flavoured with spices including cumin and ginger. It’s mild, sweet and rich with just enough heat to satisfy most tastes. Best of all it benefits from being made a day in advance as it tastes even better re-heated the next day.
Preheat the oven to 150C/300F/Gas 3 (130C fan).
Heat two tablespoons of oil in a large frying pan. Add the lamb and fry in two batches until browned. Remove from the pan with a slotted spoon and set aside.
Add the remaining oil to the pan. Add the onion and fry for 4-5 minutes, or until beginning to soften.
Meanwhile, place the ginger, garlic and chilli into a small food processor and blend until finely chopped.
Bash the cardamom pods with the end of a rolling pin to split the husks, then remove the seeds and grind them to a fine powder in a pestle and mortar. Add to the pan with the remaining spices and the garlic and ginger mixture.
Add the remaining ingredients to the pan and add the lamb. Bring to the boil, then cover and place in the oven to simmer for 1½-2 hours, or until tender. Check the seasoning and serve with boiled rice.
You need JavaScript to view this clip.
Browning meat


ssh_config —
OpenSSH SSH client configuration files
ssh(1) obtains configuration data
from the following sources in the following order:
- command-line options
- user's configuration file
(~/.ssh/config)
- system-wide configuration file
(/etc/ssh/ssh_config)
For each parameter, the first obtained value will be used. The configuration
files contain sections separated by
Host
specifications, and that section is only applied for hosts that match one of
the patterns given in the specification. The matched host name is usually the
one given on the command line (see the
CanonicalizeHostname option for exceptions).
Since the first obtained value for each parameter is used, more host-specific
declarations should be given near the beginning of the file, and general
defaults at the end.
The file contains keyword-argument pairs, one per line. Lines starting with
‘
#
’ and empty lines are interpreted as
comments. Arguments may optionally be enclosed in double quotes (") in
order to represent arguments containing spaces. Configuration options may be
separated by whitespace or optional whitespace and exactly one
‘
=
’; the latter format is useful to
avoid the need to quote whitespace when specifying configuration options using
the
ssh,
scp, and
sftp -o option.
The possible keywords and their meanings are as follows (note that keywords are
case-insensitive and arguments are case-sensitive):
- Host
- Restricts the following declarations (up to the next
Host or Match
keyword) to be only for those hosts that match one of the patterns given
after the keyword. If more than one pattern is provided, they should be
separated by whitespace. A single
‘
*
’ as a pattern can be used to
provide global defaults for all hosts. The host is usually the
hostname argument given on the command
line (see the CanonicalizeHostname keyword
for exceptions).
A pattern entry may be negated by prefixing it with an exclamation mark
(‘!’). If a negated entry is matched, then the
Host entry is ignored, regardless of whether
any other patterns on the line match. Negated matches are therefore useful
to provide exceptions for wildcard matches.
See PATTERNS for more
information on patterns.
- Match
- Restricts the following declarations (up to the next
Host or Match
keyword) to be used only when the conditions following the
Match keyword are satisfied. Match conditions
are specified using one or more criteria or the single token
all which always matches. The available
criteria keywords are: canonical,
exec, host,
originalhost,
user, and
localuser. The
all criteria must appear alone or immediately
after canonical. Other criteria may be
combined arbitrarily. All criteria but all
and canonical require an argument. Criteria
may be negated by prepending an exclamation mark (‘!’).
The canonical keyword matches only when the
configuration file is being re-parsed after hostname canonicalization (see
the CanonicalizeHostname option.) This may be
useful to specify conditions that work with canonical host names only. The
exec keyword executes the specified command
under the user's shell. If the command returns a zero exit status then the
condition is considered true. Commands containing whitespace characters
must be quoted. Arguments to exec accept the
tokens described in the TOKENS
section.
The other keywords' criteria must be single entries or comma-separated lists
and may use the wildcard and negation operators described in the
PATTERNS section. The
criteria for the host keyword are matched
against the target hostname, after any substitution by the
Hostname or
CanonicalizeHostname options. The
originalhost keyword matches against the
hostname as it was specified on the command-line. The
user keyword matches against the target
username on the remote host. The localuser
keyword matches against the name of the local user running
ssh(1) (this keyword may be
useful in system-wide ssh_config files).
- AddKeysToAgent
- Specifies whether keys should be automatically added to a
running ssh-agent(1).
If this option is set to yes and a key is
loaded from a file, the key and its passphrase are added to the agent with
the default lifetime, as if by
ssh-add(1). If this
option is set to ask,
ssh(1) will require
confirmation using the
SSH_ASKPASS
program before adding a key (see
ssh-add(1) for
details). If this option is set to confirm,
each use of the key must be confirmed, as if the
-c option was specified to
ssh-add(1). If this
option is set to no, no keys are added to the
agent. The argument must be yes,
confirm, ask, or
no (the default).
- AddressFamily
- Specifies which address family to use when connecting.
Valid arguments are any (the default),
inet (use IPv4 only), or
inet6 (use IPv6 only).
- BatchMode
- If set to yes,
passphrase/password querying will be disabled. This option is useful in
scripts and other batch jobs where no user is present to supply the
password. The argument must be yes or
no (the default).
- BindAddress
- Use the specified address on the local machine as the
source address of the connection. Only useful on systems with more than
one address. Note that this option does not work if
UsePrivilegedPort is set to
yes.
- CanonicalDomains
- When CanonicalizeHostname is
enabled, this option specifies the list of domain suffixes in which to
search for the specified destination host.
- CanonicalizeFallbackLocal
- Specifies whether to fail with an error when hostname
canonicalization fails. The default, yes,
will attempt to look up the unqualified hostname using the system
resolver's search rules. A value of no will
cause ssh(1) to fail
instantly if CanonicalizeHostname is enabled
and the target hostname cannot be found in any of the domains specified by
CanonicalDomains.
- CanonicalizeHostname
- Controls whether explicit hostname canonicalization is
performed. The default, no, is not to perform
any name rewriting and let the system resolver handle all hostname
lookups. If set to yes then, for connections
that do not use a ProxyCommand,
ssh(1) will attempt to
canonicalize the hostname specified on the command line using the
CanonicalDomains suffixes and
CanonicalizePermittedCNAMEs rules. If
CanonicalizeHostname is set to
always, then canonicalization is applied to
proxied connections too.
If this option is enabled, then the configuration files are processed again
using the new target name to pick up any new configuration in matching
Host and Match
stanzas.
- CanonicalizeMaxDots
- Specifies the maximum number of dot characters in a
hostname before canonicalization is disabled. The default, 1, allows a
single dot (i.e. hostname.subdomain).
- CanonicalizePermittedCNAMEs
- Specifies rules to determine whether CNAMEs should be
followed when canonicalizing hostnames. The rules consist of one or more
arguments of
source_domain_list:target_domain_list,
where source_domain_list is a
pattern-list of domains that may follow CNAMEs in canonicalization, and
target_domain_list is a pattern-list of
domains that they may resolve to.
For example, “*.a.example.com:*.b.example.com,*.c.example.com”
will allow hostnames matching “*.a.example.com” to be
canonicalized to names in the “*.b.example.com” or
“*.c.example.com” domains.
- CertificateFile
- Specifies a file from which the user's certificate is read.
A corresponding private key must be provided separately in order to use
this certificate either from an IdentityFile
directive or -i flag to
ssh(1), via
ssh-agent(1), or via
a PKCS11Provider.
Arguments to CertificateFile may use the tilde
syntax to refer to a user's home directory or the tokens described in the
TOKENS section.
It is possible to have multiple certificate files specified in configuration
files; these certificates will be tried in sequence. Multiple
CertificateFile directives will add to the
list of certificates used for authentication.
- ChallengeResponseAuthentication
- Specifies whether to use challenge-response authentication.
The argument to this keyword must be yes (the
default) or no.
- CheckHostIP
- If set to yes (the default),
ssh(1) will additionally
check the host IP address in the known_hosts
file. This allows it to detect if a host key changed due to DNS spoofing
and will add addresses of destination hosts to
~/.ssh/known_hosts in the process, regardless
of the setting of StrictHostKeyChecking. If
the option is set to no, the check will not
be executed.
- Ciphers
- Specifies the ciphers allowed and their order of
preference. Multiple ciphers must be comma-separated. If the specified
value begins with a ‘+’ character, then the specified
ciphers will be appended to the default set instead of replacing them. If
the specified value begins with a ‘-’ character, then the
specified ciphers (including wildcards) will be removed from the default
set instead of replacing them.
The supported ciphers are:
3des-cbc
aes128-cbc
aes192-cbc
aes256-cbc
aes128-ctr
aes192-ctr
aes256-ctr
<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>The default is:
<EMAIL_ADDRESS>aes128-ctr,aes192-ctr,aes256-ctr,
aes128-gcm<EMAIL_ADDRESS>aes128-cbc,aes192-cbc,aes256-cbc
The list of available ciphers may also be obtained using “ssh -Q
cipher”.
- ClearAllForwardings
- Specifies that all local, remote, and dynamic port
forwardings specified in the configuration files or on the command line be
cleared. This option is primarily useful when used from the
ssh(1) command line to
clear port forwardings set in configuration files, and is automatically
set by scp(1) and
sftp(1). The argument must
be yes or no
(the default).
- Compression
- Specifies whether to use compression. The argument must be
yes or no (the
default).
- ConnectionAttempts
- Specifies the number of tries (one per second) to make
before exiting. The argument must be an integer. This may be useful in
scripts if the connection sometimes fails. The default is 1.
- ConnectTimeout
- Specifies the timeout (in seconds) used when connecting to
the SSH server, instead of using the default system TCP timeout. This
value is used only when the target is down or really unreachable, not when
it refuses the connection.
- ControlMaster
- Enables the sharing of multiple sessions over a single
network connection. When set to yes,
ssh(1) will listen for
connections on a control socket specified using the
ControlPath argument. Additional sessions can
connect to this socket using the same
ControlPath with
ControlMaster set to
no (the default). These sessions will try to
reuse the master instance's network connection rather than initiating new
ones, but will fall back to connecting normally if the control socket does
not exist, or is not listening.
Setting this to ask will cause
ssh(1) to listen for
control connections, but require confirmation using
ssh-askpass(1). If
the ControlPath cannot be opened,
ssh(1) will continue
without connecting to a master instance.
X11 and ssh-agent(1)
forwarding is supported over these multiplexed connections, however the
display and agent forwarded will be the one belonging to the master
connection i.e. it is not possible to forward multiple displays or agents.
Two additional options allow for opportunistic multiplexing: try to use a
master connection but fall back to creating a new one if one does not
already exist. These options are: auto and
autoask. The latter requires confirmation
like the ask option.
- ControlPath
- Specify the path to the control socket used for connection
sharing as described in the ControlMaster
section above or the string none to disable
connection sharing. Arguments to ControlPath
may use the tilde syntax to refer to a user's home directory or the tokens
described in the TOKENS
section. It is recommended that any
ControlPath used for opportunistic connection
sharing include at least %h, %p, and %r (or alternatively %C) and be
placed in a directory that is not writable by other users. This ensures
that shared connections are uniquely identified.
- ControlPersist
- When used in conjunction with
ControlMaster, specifies that the master
connection should remain open in the background (waiting for future client
connections) after the initial client connection has been closed. If set
to no, then the master connection will not be
placed into the background, and will close as soon as the initial client
connection is closed. If set to yes or 0,
then the master connection will remain in the background indefinitely
(until killed or closed via a mechanism such as the “ssh -O
exit”). If set to a time in seconds, or a time in any of the
formats documented in
sshd_config(5),
then the backgrounded master connection will automatically terminate after
it has remained idle (with no client connections) for the specified
time.
- DynamicForward
- Specifies that a TCP port on the local machine be forwarded
over the secure channel, and the application protocol is then used to
determine where to connect to from the remote machine.
The argument must be
[bind_address:]port.
IPv6 addresses can be specified by enclosing addresses in square brackets.
By default, the local port is bound in accordance with the
GatewayPorts setting. However, an explicit
bind_address may be used to bind the
connection to a specific address. The
bind_address of
localhost indicates that the listening port
be bound for local use only, while an empty address or ‘*’
indicates that the port should be available from all interfaces.
Currently the SOCKS4 and SOCKS5 protocols are supported, and
ssh(1) will act as a SOCKS
server. Multiple forwardings may be specified, and additional forwardings
can be given on the command line. Only the superuser can forward
privileged ports.
- EnableSSHKeysign
- Setting this option to yes in
the global client configuration file
/etc/ssh/ssh_config enables the use of the
helper program
ssh-keysign(8)
during HostbasedAuthentication. The argument
must be yes or
no (the default). This option should be
placed in the non-hostspecific section. See
ssh-keysign(8) for
more information.
- EscapeChar
- Sets the escape character (default:
‘
~
’). The escape character can also
be set on the command line. The argument should be a single character,
‘^
’ followed by a letter, or
none to disable the escape character entirely
(making the connection transparent for binary data).
- ExitOnForwardFailure
- Specifies whether
ssh(1) should terminate the
connection if it cannot set up all requested dynamic, tunnel, local, and
remote port forwardings, (e.g. if either end is unable to bind and listen
on a specified port). Note that
ExitOnForwardFailure does not apply to
connections made over port forwardings and will not, for example, cause
ssh(1) to exit if TCP
connections to the ultimate forwarding destination fail. The argument must
be yes or no
(the default).
- FingerprintHash
- Specifies the hash algorithm used when displaying key
fingerprints. Valid options are: md5 and
sha256 (the default).
- ForwardAgent
- Specifies whether the connection to the authentication
agent (if any) will be forwarded to the remote machine. The argument must
be yes or no
(the default).
Agent forwarding should be enabled with caution. Users with the ability to
bypass file permissions on the remote host (for the agent's Unix-domain
socket) can access the local agent through the forwarded connection. An
attacker cannot obtain key material from the agent, however they can
perform operations on the keys that enable them to authenticate using the
identities loaded into the agent.
- ForwardX11
- Specifies whether X11 connections will be automatically
redirected over the secure channel and
DISPLAY
set. The argument must be
yes or no (the
default).
X11 forwarding should be enabled with caution. Users with the ability to
bypass file permissions on the remote host (for the user's X11
authorization database) can access the local X11 display through the
forwarded connection. An attacker may then be able to perform activities
such as keystroke monitoring if the
ForwardX11Trusted option is also
enabled.
- ForwardX11Timeout
- Specify a timeout for untrusted X11 forwarding using the
format described in the TIME
FORMATS section of
sshd_config(5). X11
connections received by
ssh(1) after this time will
be refused. The default is to disable untrusted X11 forwarding after
twenty minutes has elapsed.
- ForwardX11Trusted
- If this option is set to yes,
remote X11 clients will have full access to the original X11 display.
If this option is set to no (the default),
remote X11 clients will be considered untrusted and prevented from
stealing or tampering with data belonging to trusted X11 clients.
Furthermore, the xauth(1)
token used for the session will be set to expire after 20 minutes. Remote
clients will be refused access after this time.
See the X11 SECURITY extension specification for full details on the
restrictions imposed on untrusted clients.
- GatewayPorts
- Specifies whether remote hosts are allowed to connect to
local forwarded ports. By default,
ssh(1) binds local port
forwardings to the loopback address. This prevents other remote hosts from
connecting to forwarded ports. GatewayPorts
can be used to specify that ssh should bind local port forwardings to the
wildcard address, thus allowing remote hosts to connect to forwarded
ports. The argument must be yes or
no (the default).
- GlobalKnownHostsFile
- Specifies one or more files to use for the global host key
database, separated by whitespace. The default is
/etc/ssh/ssh_known_hosts,
/etc/ssh/ssh_known_hosts2.
- GSSAPIAuthentication
- Specifies whether user authentication based on GSSAPI is
allowed. The default is no.
- GSSAPIDelegateCredentials
- Forward (delegate) credentials to the server. The default
is no.
- HashKnownHosts
- Indicates that
ssh(1) should hash host
names and addresses when they are added to
~/.ssh/known_hosts. These hashed names may be
used normally by ssh(1) and
sshd(8), but they do not
reveal identifying information should the file's contents be disclosed.
The default is no. Note that existing names
and addresses in known hosts files will not be converted automatically,
but may be manually hashed using
ssh-keygen(1).
- HostbasedAuthentication
- Specifies whether to try rhosts based authentication with
public key authentication. The argument must be
yes or no (the
default).
- HostbasedKeyTypes
- Specifies the key types that will be used for hostbased
authentication as a comma-separated pattern list. Alternately if the
specified value begins with a ‘+’ character, then the
specified key types will be appended to the default set instead of
replacing them. If the specified value begins with a ‘-’
character, then the specified key types (including wildcards) will be
removed from the default set instead of replacing them. The default for
this option is:
<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
ssh-ed25519,ssh-rsa
The -Q option of
ssh(1) may be used to list
supported key types.
- HostKeyAlgorithms
- Specifies the host key algorithms that the client wants to
use in order of preference. Alternately if the specified value begins with
a ‘+’ character, then the specified key types will be
appended to the default set instead of replacing them. If the specified
value begins with a ‘-’ character, then the specified key
types (including wildcards) will be removed from the default set instead
of replacing them. The default for this option is:
<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
ssh-ed25519,ssh-rsa
If hostkeys are known for the destination host then this default is modified
to prefer their algorithms.
The list of available key types may also be obtained using “ssh -Q
key”.
- HostKeyAlias
- Specifies an alias that should be used instead of the real
host name when looking up or saving the host key in the host key database
files and when validating host certificates. This option is useful for
tunneling SSH connections or for multiple servers running on a single
host.
- HostName
- Specifies the real host name to log into. This can be used
to specify nicknames or abbreviations for hosts. Arguments to
HostName accept the tokens described in the
TOKENS section. Numeric IP
addresses are also permitted (both on the command line and in
HostName specifications). The default is the
name given on the command line.
- IdentitiesOnly
- Specifies that
ssh(1) should only use the
authentication identity and certificate files explicitly configured in the
ssh_config files or passed on the
ssh(1) command-line, even
if ssh-agent(1) or a
PKCS11Provider offers more identities. The
argument to this keyword must be yes or
no (the default). This option is intended for
situations where ssh-agent offers many different identities.
- IdentityAgent
- Specifies the UNIX-domain socket
used to communicate with the authentication agent.
This option overrides the
SSH_AUTH_SOCK
environment variable and can be used to select a specific agent. Setting
the socket name to none disables the use of
an authentication agent. If the string “SSH_AUTH_SOCK” is
specified, the location of the socket will be read from the
SSH_AUTH_SOCK
environment variable.
Arguments to IdentityAgent may use the tilde
syntax to refer to a user's home directory or the tokens described in the
TOKENS section.
- IdentityFile
- Specifies a file from which the user's DSA, ECDSA, Ed25519
or RSA authentication identity is read. The default is
~/.ssh/id_dsa,
~/.ssh/id_ecdsa,
~/.ssh/id_ed25519 and
~/.ssh/id_rsa. Additionally, any identities
represented by the authentication agent will be used for authentication
unless IdentitiesOnly is set. If no
certificates have been explicitly specified by
CertificateFile,
ssh(1) will try to load
certificate information from the filename obtained by appending
-cert.pub to the path of a specified
IdentityFile.
Arguments to IdentityFile may use the tilde
syntax to refer to a user's home directory or the tokens described in the
TOKENS section.
It is possible to have multiple identity files specified in configuration
files; all these identities will be tried in sequence. Multiple
IdentityFile directives will add to the list
of identities tried (this behaviour differs from that of other
configuration directives).
IdentityFile may be used in conjunction with
IdentitiesOnly to select which identities in
an agent are offered during authentication.
IdentityFile may also be used in conjunction
with CertificateFile in order to provide any
certificate also needed for authentication with the identity.
- IgnoreUnknown
- Specifies a pattern-list of unknown options to be ignored
if they are encountered in configuration parsing. This may be used to
suppress errors if ssh_config contains
options that are unrecognised by
ssh(1). It is recommended
that IgnoreUnknown be listed early in the
configuration file as it will not be applied to unknown options that
appear before it.
- Include
- Include the specified configuration file(s). Multiple
pathnames may be specified and each pathname may contain
glob(3) wildcards and, for
user configurations, shell-like ‘~’ references to user home
directories. Files without absolute paths are assumed to be in
~/.ssh if included in a user configuration
file or /etc/ssh if included from the system
configuration file. Include directive may
appear inside a Match or
Host block to perform conditional
inclusion.
- IPQoS
- Specifies the IPv4 type-of-service or DSCP class for
connections. Accepted values are af11,
af12, af13,
af21, af22,
af23, af31,
af32, af33,
af41, af42,
af43, cs0,
cs1, cs2,
cs3, cs4,
cs5, cs6,
cs7, ef,
lowdelay,
throughput,
reliability, a numeric value, or
none to use the operating system default.
This option may take one or two arguments, separated by whitespace. If one
argument is specified, it is used as the packet class unconditionally. If
two values are specified, the first is automatically selected for
interactive sessions and the second for non-interactive sessions. The
default is lowdelay for interactive sessions
and throughput for non-interactive
sessions.
- KbdInteractiveAuthentication
- Specifies whether to use keyboard-interactive
authentication. The argument to this keyword must be
yes (the default) or
no.
- KbdInteractiveDevices
- Specifies the list of methods to use in
keyboard-interactive authentication. Multiple method names must be
comma-separated. The default is to use the server specified list. The
methods available vary depending on what the server supports. For an
OpenSSH server, it may be zero or more of:
bsdauth, pam,
and skey.
- KexAlgorithms
- Specifies the available KEX (Key Exchange) algorithms.
Multiple algorithms must be comma-separated. Alternately if the specified
value begins with a ‘+’ character, then the specified
methods will be appended to the default set instead of replacing them. If
the specified value begins with a ‘-’ character, then the
specified methods (including wildcards) will be removed from the default
set instead of replacing them. The default is:
<EMAIL_ADDRESS>ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,
diffie-hellman-group-exchange-sha256,
diffie-hellman-group-exchange-sha1,
diffie-hellman-group14-sha1
The list of available key exchange algorithms may also be obtained using
“ssh -Q kex”.
- LocalCommand
- Specifies a command to execute on the local machine after
successfully connecting to the server. The command string extends to the
end of the line, and is executed with the user's shell. Arguments to
LocalCommand accept the tokens described in
the TOKENS section.
The command is run synchronously and does not have access to the session of
the ssh(1) that spawned it.
It should not be used for interactive commands.
This directive is ignored unless
PermitLocalCommand has been enabled.
- LocalForward
- Specifies that a TCP port on the local machine be forwarded
over the secure channel to the specified host and port from the remote
machine. The first argument must be
[bind_address:]port
and the second argument must be
host:hostport.
IPv6 addresses can be specified by enclosing addresses in square brackets.
Multiple forwardings may be specified, and additional forwardings can be
given on the command line. Only the superuser can forward privileged
ports. By default, the local port is bound in accordance with the
GatewayPorts setting. However, an explicit
bind_address may be used to bind the
connection to a specific address. The
bind_address of
localhost indicates that the listening port
be bound for local use only, while an empty address or ‘*’
indicates that the port should be available from all interfaces.
- LogLevel
- Gives the verbosity level that is used when logging
messages from ssh(1). The
possible values are: QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1,
DEBUG2, and DEBUG3. The default is INFO. DEBUG and DEBUG1 are equivalent.
DEBUG2 and DEBUG3 each specify higher levels of verbose output.
- MACs
- Specifies the MAC (message authentication code) algorithms
in order of preference. The MAC algorithm is used for data integrity
protection. Multiple algorithms must be comma-separated. If the specified
value begins with a ‘+’ character, then the specified
algorithms will be appended to the default set instead of replacing them.
If the specified value begins with a ‘-’ character, then the
specified algorithms (including wildcards) will be removed from the
default set instead of replacing them.
The algorithms that contain “-etm” calculate the MAC after
encryption (encrypt-then-mac). These are considered safer and their use
recommended.
The default is:
umac-64-etm<EMAIL_ADDRESS>hmac-sha2-256-etm<EMAIL_ADDRESS><EMAIL_ADDRESS>umac-64<EMAIL_ADDRESS>hmac-sha2-256,hmac-sha2-512,hmac-sha1
The list of available MAC algorithms may also be obtained using “ssh
-Q mac”.
- NoHostAuthenticationForLocalhost
- This option can be used if the home directory is shared
across machines. In this case localhost will refer to a different machine
on each of the machines and the user will get many warnings about changed
host keys. However, this option disables host authentication for
localhost. The argument to this keyword must be
yes or no (the
default).
- NumberOfPasswordPrompts
- Specifies the number of password prompts before giving up.
The argument to this keyword must be an integer. The default is 3.
- PasswordAuthentication
- Specifies whether to use password authentication. The
argument to this keyword must be yes (the
default) or no.
- PermitLocalCommand
- Allow local command execution via the
LocalCommand option or using the
!command
escape sequence in ssh(1).
The argument must be yes or
no (the default).
- PKCS11Provider
- Specifies which PKCS#11 provider to use. The argument to
this keyword is the PKCS#11 shared library
ssh(1) should use to
communicate with a PKCS#11 token providing the user's private RSA
key.
- Port
- Specifies the port number to connect on the remote host.
The default is 22.
- PreferredAuthentications
- Specifies the order in which the client should try
authentication methods. This allows a client to prefer one method (e.g.
keyboard-interactive) over another method
(e.g. password). The default is:
gssapi-with-mic,hostbased,publickey,
keyboard-interactive,password
- ProxyCommand
- Specifies the command to use to connect to the server. The
command string extends to the end of the line, and is executed using the
user's shell ‘
exec
’ directive to
avoid a lingering shell process.
Arguments to ProxyCommand accept the tokens
described in the TOKENS
section. The command can be basically anything, and should read from its
standard input and write to its standard output. It should eventually
connect an sshd(8) server
running on some machine, or execute sshd -i
somewhere. Host key management will be done using the HostName of the host
being connected (defaulting to the name typed by the user). Setting the
command to none disables this option
entirely. Note that CheckHostIP is not
available for connects with a proxy command.
This directive is useful in conjunction with
nc(1) and its proxy support.
For example, the following directive would connect via an HTTP proxy at
<IP_ADDRESS>:
ProxyCommand /usr/bin/nc -X connect -x <IP_ADDRESS>:8080 %h %p
- ProxyJump
- Specifies one or more jump proxies as
[user@]host[:port].
Multiple proxies may be separated by comma characters and will be visited
sequentially. Setting this option will cause
ssh(1) to connect to the
target host by first making a
ssh(1) connection to the
specified ProxyJump host and then
establishing a TCP forwarding to the ultimate target from there.
Note that this option will compete with the
ProxyCommand option - whichever is specified
first will prevent later instances of the other from taking effect.
- ProxyUseFdpass
- Specifies that ProxyCommand
will pass a connected file descriptor back to
ssh(1) instead of
continuing to execute and pass data. The default is
no.
- PubkeyAcceptedKeyTypes
- Specifies the key types that will be used for public key
authentication as a comma-separated pattern list. Alternately if the
specified value begins with a ‘+’ character, then the key
types after it will be appended to the default instead of replacing it. If
the specified value begins with a ‘-’ character, then the
specified key types (including wildcards) will be removed from the default
set instead of replacing them. The default for this option is:
<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
ssh-ed25519,ssh-rsa
The list of available key types may also be obtained using “ssh -Q
key”.
- PubkeyAuthentication
- Specifies whether to try public key authentication. The
argument to this keyword must be yes (the
default) or no.
- RekeyLimit
- Specifies the maximum amount of data that may be
transmitted before the session key is renegotiated, optionally followed a
maximum amount of time that may pass before the session key is
renegotiated. The first argument is specified in bytes and may have a
suffix of ‘K’, ‘M’, or ‘G’ to
indicate Kilobytes, Megabytes, or Gigabytes, respectively. The default is
between ‘1G’ and ‘4G’, depending on the
cipher. The optional second value is specified in seconds and may use any
of the units documented in the
TIME FORMATS section of
sshd_config(5). The
default value for RekeyLimit is
default none, which means that rekeying is
performed after the cipher's default amount of data has been sent or
received and no time based rekeying is done.
- RemoteCommand
- Specifies a command to execute on the remote machine after
successfully connecting to the server. The command string extends to the
end of the line, and is executed with the user's shell. Arguments to
RemoteCommand accept the tokens described in
the TOKENS section.
- RemoteForward
- Specifies that a TCP port on the remote machine be
forwarded over the secure channel. The remote port may either be fowarded
to a specified host and port from the local machine, or may act as a SOCKS
4/5 proxy that allows a remote client to connect to arbitrary destinations
from the local machine. The first argument must be
[bind_address:]port
If forwarding to a specific destination then the second argument must be
host:hostport,
otherwise if no destination argument is specified then the remote
forwarding will be established as a SOCKS proxy.
IPv6 addresses can be specified by enclosing addresses in square brackets.
Multiple forwardings may be specified, and additional forwardings can be
given on the command line. Privileged ports can be forwarded only when
logging in as root on the remote machine.
If the port argument is 0, the listen port
will be dynamically allocated on the server and reported to the client at
run time.
If the bind_address is not specified, the
default is to only bind to loopback addresses. If the
bind_address is
‘
*
’ or an empty string, then the
forwarding is requested to listen on all interfaces. Specifying a remote
bind_address will only succeed if the
server's GatewayPorts option is enabled (see
sshd_config(5)).
- RequestTTY
- Specifies whether to request a pseudo-tty for the session.
The argument may be one of: no (never request
a TTY), yes (always request a TTY when
standard input is a TTY), force (always
request a TTY) or auto (request a TTY when
opening a login session). This option mirrors the
-t and -T flags
for ssh(1).
- RevokedHostKeys
- Specifies revoked host public keys. Keys listed in this
file will be refused for host authentication. Note that if this file does
not exist or is not readable, then host authentication will be refused for
all hosts. Keys may be specified as a text file, listing one public key
per line, or as an OpenSSH Key Revocation List (KRL) as generated by
ssh-keygen(1). For
more information on KRLs, see the KEY REVOCATION LISTS section in
ssh-keygen(1).
- SendEnv
- Specifies what variables from the local
environ(7) should be
sent to the server. The server must also support it, and the server must
be configured to accept these environment variables. Note that the
TERM
environment variable is always
sent whenever a pseudo-terminal is requested as it is required by the
protocol. Refer to AcceptEnv in
sshd_config(5) for
how to configure the server. Variables are specified by name, which may
contain wildcard characters. Multiple environment variables may be
separated by whitespace or spread across multiple
SendEnv directives. The default is not to
send any environment variables.
See PATTERNS for more
information on patterns.
- ServerAliveCountMax
- Sets the number of server alive messages (see below) which
may be sent without ssh(1)
receiving any messages back from the server. If this threshold is reached
while server alive messages are being sent, ssh will disconnect from the
server, terminating the session. It is important to note that the use of
server alive messages is very different from
TCPKeepAlive (below). The server alive
messages are sent through the encrypted channel and therefore will not be
spoofable. The TCP keepalive option enabled by
TCPKeepAlive is spoofable. The server alive
mechanism is valuable when the client or server depend on knowing when a
connection has become inactive.
The default value is 3. If, for example,
ServerAliveInterval (see below) is set to 15
and ServerAliveCountMax is left at the
default, if the server becomes unresponsive, ssh will disconnect after
approximately 45 seconds.
- ServerAliveInterval
- Sets a timeout interval in seconds after which if no data
has been received from the server,
ssh(1) will send a message
through the encrypted channel to request a response from the server. The
default is 0, indicating that these messages will not be sent to the
server.
- StreamLocalBindMask
- Sets the octal file creation mode mask (umask) used when
creating a Unix-domain socket file for local or remote port forwarding.
This option is only used for port forwarding to a Unix-domain socket file.
The default value is 0177, which creates a Unix-domain socket file that is
readable and writable only by the owner. Note that not all operating
systems honor the file mode on Unix-domain socket files.
- StreamLocalBindUnlink
- Specifies whether to remove an existing Unix-domain socket
file for local or remote port forwarding before creating a new one. If the
socket file already exists and
StreamLocalBindUnlink is not enabled,
ssh will be unable to forward the port to the
Unix-domain socket file. This option is only used for port forwarding to a
Unix-domain socket file.
The argument must be yes or
no (the default).
- StrictHostKeyChecking
- If this flag is set to yes,
ssh(1) will never
automatically add host keys to the
~/.ssh/known_hosts file, and refuses to
connect to hosts whose host key has changed. This provides maximum
protection against trojan horse attacks, though it can be annoying when
the /etc/ssh/ssh_known_hosts file is poorly
maintained or when connections to new hosts are frequently made. This
option forces the user to manually add all new hosts.
If this flag is set to “accept-new” then ssh will
automatically add new host keys to the user known hosts files, but will
not permit connections to hosts with changed host keys. If this flag is
set to “no” or “off”, ssh will automatically
add new host keys to the user known hosts files and allow connections to
hosts with changed hostkeys to proceed, subject to some restrictions. If
this flag is set to ask (the default), new
host keys will be added to the user known host files only after the user
has confirmed that is what they really want to do, and ssh will refuse to
connect to hosts whose host key has changed. The host keys of known hosts
will be verified automatically in all cases.
- SyslogFacility
- Gives the facility code that is used when logging messages
from ssh(1). The possible
values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4,
LOCAL5, LOCAL6, LOCAL7. The default is USER.
- TCPKeepAlive
- Specifies whether the system should send TCP keepalive
messages to the other side. If they are sent, death of the connection or
crash of one of the machines will be properly noticed. However, this means
that connections will die if the route is down temporarily, and some
people find it annoying.
The default is yes (to send TCP keepalive
messages), and the client will notice if the network goes down or the
remote host dies. This is important in scripts, and many users want it
too.
To disable TCP keepalive messages, the value should be set to
no.
- Tunnel
- Request
tun(4) device forwarding
between the client and the server. The argument must be
yes,
point-to-point (layer 3),
ethernet (layer 2), or
no (the default). Specifying
yes requests the default tunnel mode, which
is point-to-point.
- TunnelDevice
- Specifies the
tun(4) devices to open on
the client (local_tun) and the server
(remote_tun).
The argument must be
local_tun[:remote_tun].
The devices may be specified by numerical ID or the keyword
any, which uses the next available tunnel
device. If remote_tun is not specified,
it defaults to any. The default is
any:any.
- UpdateHostKeys
- Specifies whether
ssh(1) should accept
notifications of additional hostkeys from the server sent after
authentication has completed and add them to
UserKnownHostsFile. The argument must be
yes, no (the
default) or ask. Enabling this option allows
learning alternate hostkeys for a server and supports graceful key
rotation by allowing a server to send replacement public keys before old
ones are removed. Additional hostkeys are only accepted if the key used to
authenticate the host was already trusted or explicitly accepted by the
user. If UpdateHostKeys is set to
ask, then the user is asked to confirm the
modifications to the known_hosts file. Confirmation is currently
incompatible with ControlPersist, and will be
disabled if it is enabled.
Presently, only sshd(8) from
OpenSSH 6.8 and greater support the<EMAIL_ADDRESS>protocol extension used to inform the client of all the server's
hostkeys.
- UsePrivilegedPort
- Specifies whether to use a privileged port for outgoing
connections. The argument must be yes or
no (the default). If set to
yes,
ssh(1) must be setuid
root.
- User
- Specifies the user to log in as. This can be useful when a
different user name is used on different machines. This saves the trouble
of having to remember to give the user name on the command line.
- UserKnownHostsFile
- Specifies one or more files to use for the user host key
database, separated by whitespace. The default is
~/.ssh/known_hosts,
~/.ssh/known_hosts2.
- VerifyHostKeyDNS
- Specifies whether to verify the remote key using DNS and
SSHFP resource records. If this option is set to
yes, the client will implicitly trust keys
that match a secure fingerprint from DNS. Insecure fingerprints will be
handled as if this option was set to ask. If
this option is set to ask, information on
fingerprint match will be displayed, but the user will still need to
confirm new host keys according to the
StrictHostKeyChecking option. The default is
no.
See also VERIFYING HOST
KEYS in ssh(1).
- VisualHostKey
- If this flag is set to yes, an
ASCII art representation of the remote host key fingerprint is printed in
addition to the fingerprint string at login and for unknown host keys. If
this flag is set to no (the default), no
fingerprint strings are printed at login and only the fingerprint string
will be printed for unknown host keys.
- XAuthLocation
- Specifies the full pathname of the
xauth(1) program. The
default is /usr/X11R6/bin/xauth.
A
pattern consists of zero or more non-whitespace
characters, ‘*’ (a wildcard that matches zero or more
characters), or ‘?’ (a wildcard that matches exactly one
character). For example, to specify a set of declarations for any host in the
“.co.uk” set of domains, the following pattern could be used:
Host *.co.uk
The following pattern would match any host in the 192.168.0.[0-9] network range:
Host 192.168.0.?
A
pattern-list is a comma-separated list of
patterns. Patterns within pattern-lists may be negated by preceding them with
an exclamation mark (‘!’). For example, to allow a key to be
used from anywhere within an organization except from the
“dialup” pool, the following entry (in authorized_keys) could be
used:
from="!*.dialup.example.com,*.example.com"
Arguments to some keywords can make use of tokens, which are expanded at
runtime:
- %%
- A literal ‘%’.
- %C
- Shorthand for %l%h%p%r.
- %d
- Local user's home directory.
- %h
- The remote hostname.
- %i
- The local user ID.
- %L
- The local hostname.
- %l
- The local hostname, including the domain name.
- %n
- The original remote hostname, as given on the command
line.
- %p
- The remote port.
- %r
- The remote username.
- %u
- The local username.
Match exec accepts the tokens %%, %h, %L, %l, %n,
%p, %r, and %u.
CertificateFile accepts the tokens %%, %d, %h, %l,
%r, and %u.
ControlPath accepts the tokens %%, %C, %h, %i, %L,
%l, %n, %p, %r, and %u.
HostName accepts the tokens %% and %h.
IdentityAgent and
IdentityFile accept the tokens %%, %d, %h, %l,
%r, and %u.
LocalCommand accepts the tokens %%, %C, %d, %h, %l,
%n, %p, %r, and %u.
ProxyCommand accepts the tokens %%, %h, %p, and %r.
RemoteCommand accepts the tokens %%, %C, %d, %h,
%l, %n, %p, %r, and %u.
- ~/.ssh/config
- This is the per-user configuration file. The format of this
file is described above. This file is used by the SSH client. Because of
the potential for abuse, this file must have strict permissions:
read/write for the user, and not accessible by others.
- /etc/ssh/ssh_config
- Systemwide configuration file. This file provides defaults
for those values that are not specified in the user's configuration file,
and for those users who do not have a configuration file. This file must
be world-readable.
ssh(1)
OpenSSH is a derivative of the original and free ssh 1.2.12 release by
Tatu Ylonen.
Aaron Campbell,
Bob Beck,
Markus Friedl,
Niels Provos,
Theo de Raadt and
Dug Song removed many bugs, re-added newer
features and created OpenSSH.
Markus Friedl
contributed the support for SSH protocol versions 1.5 and 2.0.


Davis Cup Finals an 'absolute success', says Pique
Madrid - Barcelona footballer Gerard Pique insisted on Saturday the inaugural Davis Cup Finals in Madrid have been an "absolute success", although he did admit some changes would have to be made in future.
The controversial week-long finals were launched by Pique's investment company Kosmos, replacing the old World Group which saw teams play each other in longer ties spread across the year.
"The competition is an absolute success," Pique told broadcasters Movistar.
"The most important thing is that it has a soul... The players have reactions that they don't even have in the Grand Slams."
There have been some issues at the Caja Magica, with low attendances for many matches, while Wednesday's group-stage tie between the United States and Italy ended at 4:04am local time.
"I think this is the base and from there it will grow a lot," added Pique.
"Things are going to be retouched, obviously. The issue of the schedules must be retouched. But that's what happens to events when the format is changed."
Pique arrived at the Caja Magica to watch Spain's semi-final against Britain after playing in Barcelona's 2-1 win over Leganes earlier on Saturday.
Canada beat Russia in the other last-four match to book their place in Sunday's final.
Results from the sixth day of the inaugural Davis Cup Finals in Madrid on Saturday:
Semi-finals
Canada 2 Russia 1
Singles
Andrey Rublev (RUS) bt Vasek Pospisil (CAN) 6-4, 6-4
Denis Shapovalov (CAN) bt Karen Khachanov (RUS) 6-4, 4-6, 6-4
Doubles
Vasek Pospisil/Denis Shapovalov (CAN) bt Andrey Rublev/Karen Khachanov (RUS) 6-3, 3-6, 6-7 (5/7)
Spain 2 Britain 1
Singles
Kyle Edmund (GBR) bt Feliciano Lopez (ESP) 6-3, 7-6 (7/3)
Rafael Nadal (ESP) bt Dan Evans (GBR) 6-4, 6-0
Doubles
Marcel Granollers/Feliciano Lopez (ESP) bt Jamie Murray/Neal Skupski (GBR) 7-6 (7/3), 7-6 (10/8)