Commit graph

12098 commits

Author SHA1 Message Date
Jack Conradson
58fafe224f
Add source fallback support for match_only_text mapped type (#89473)
This change adds access to mapped match_only_text fields via the Painless scripting fields API. The 
values returned from a match_only_text field via the scripting fields API always use source as described 
by (#81246). These are not available via doc values so there are no bwc issues.
2022-08-22 07:32:25 -07:00
Rory Hunter
f0df4b769a
Updates to changelog processing after docs redesign (#89463) 2022-08-18 11:44:35 -07:00
Jack Conradson
058ea4594a
Add source fallback support for date and date_nanos mapped types (#89440)
This change adds source fallback support for date and date_nanos by using the existing 
SourceValueFetcherSortedNumericIndexFieldData to emulate doc values.
2022-08-18 07:33:05 -07:00
mushaoqiong
22e1150dd6
Reuse Info in lifecycle step (#89419)
We have a `SingleMessageFiledInfo` defined in
`org/elasticsearch/xpack/core/ilm/step/info` to provide single message
info for `AsyncWaitStep` and `ClusterStateWaitStep`.But there are still
some steps like `CheckNotDataStreamWriteIndexStep` defining their own
single message info. This pr removes the duplicated info defination in
these steps and use `SingleMessageFiledInfo` instand.
2022-08-19 00:01:16 +09:30
Yang Wang
3bb13e245e
Return 400 error for GetUserPrivileges call with API keys (#89333)
The GetUserPrivileges API returns a 500 error when it is called with an
API key that has assigned role descriptors. This is because the
underlying LimitedRole class that represents the API key's effective
privileges does not support building a simple view of the privileges.

This PR changes the code to return 400 error instead of 500 along with a
better error message that suggests the GetApiKey API as an alternative.

Relates: #89058
2022-08-18 12:34:43 +09:30
Yang Wang
725367e14b
User Profile - Detailed errors in hasPrivileges response (#89224)
This PR adds a new `errors` field in the ProfilehasPrivileges response
to report detailed errors encountered, including missing UIDs. It also
removes the existing `errors_uids` field since this is redundant after
the change.
2022-08-18 11:37:04 +09:30
Joe Gallo
3bde177fea
Rollover min_* conditions docs and highlight (#89434) 2022-08-17 15:24:18 -04:00
dh-cloud
f31b1f6d57
fix a typo in Security.java (#89248)
Fix name of path.conf option.
2022-08-17 12:53:48 -04:00
Jack Conradson
1aa43ecf2c
Add text field support in the Painless scripting fields API (#89396)
This change adds access to mapped text fields via the Painless scripting fields API. The values returned 
from a text field via the scripting fields API always use source as described by (#81246). Access via the 
old-style through doc will still depend on field data, so there is no change and avoids bwc issues.
2022-08-17 09:13:13 -07:00
Jack Conradson
f849847aef
Fix duplication bug for source fallback in numeric types (#89352)
Currently, source fallback numeric types do not match doc values numeric types. Source fallback 
numeric types de-duplicate numeric values in multi-valued fields. This change removes the de-
duplication for source fallback values for numeric types using value fetchers. This also adds test cases 
for all the supported source fallback types to ensure they continue to match their doc values 
counterparts exactly.
2022-08-17 08:10:51 -07:00
Jack Conradson
fe8e58658b
Add source fallback support for unsigned long mapped type (#89349)
This change adds source fallback support for unsigned long by adding a new 
SourceValueFetcherSortedUnsignedLongIndexFieldData similar to the other numeric types.
2022-08-17 08:10:17 -07:00
Adam Michalik
a1056f1e00
Docs: Correct ctx.op value to valid 'noop' (#89391)
The documentation mentions the `noop` value ("Otherwise it does nothing (`noop`)"), however, the value used in the example script is `none`. This change corrects the value in the example script to `noop`.
2022-08-17 09:52:34 -05:00
mushaoqiong
ad612746c6
move log-related logic into log block in IndexLifecycleRunner (#89292)
This PR moved some logic that is only used by log in
IndexLifecycleRunner#isReadyToRansitionToThisPhase(...) into trace-log-
block which may save cpu and memory if trace log was not enabled.
2022-08-17 23:59:15 +09:30
Francisco Fernández Castaño
837a8d7a6e
Add support for floating point node.processors setting (#89281)
This commit adds support for floating point node.processors setting.
This is useful when the nodes run in an environment where the CPU
time assigned to the ES node process is limited (i.e. using cgroups).
With this change, the system would be able to size the thread pools
accordingly, in this case it would round up the provided setting
to the closest integer.
2022-08-17 15:00:39 +02:00
Luca Cavanna
c038a91c60
Assign the right path to objects merged when parsing mappings (#89389)
When parsing mappings, we may find a field with same name specified twice, either
because JSON duplicate keys are allowed, or because a mix of object notation and dot
notation is used when providing mappings. The same can happen when applying dynamic
mappings as part of parsing an incoming document, as well as when merging separate
index templates that may contain the definition for the same field using a
mix of object notation and dot notation.

While we propagate the MapperBuilderContext across merge calls thanks to #86946, we do not
propagate the right context when we call merge on objects as part of parsing/building
mappings. This causes a situation in which the leaf fields that result from the merge
have the wrong path, which misses the first portion e.g. sub.field instead of obj.sub.field.

This commit applies the correct mapper builder context when building the object mapper builder
and two objects with same name are found.

Relates to #86946

Closes #88573
2022-08-17 14:39:12 +02:00
Nik Everett
09d00259f4
Graph: fix race condition in timeout (#88946)
Previously `graph` checked if the request timed out, then spent some
time doing work, then passed the timeout on to the next request. Over
and over again. It's quite possible that the response may not have timed
out for the first check but would have timed out for the second check.
This manifests as the timeout being sent to the next hop being a
negative number of milliseconds. We don't allow this sort of thing.

This fixes this by moving the timeout check to the same spot it is read
for setting the timeout on the next request - we just check if its `> 0`
to find the timeouts.

This does keep the request running slightly longer after it's officially
timed out - but it's just long enough to prepare the next layer of
request. Usually microseconds. Which should be fine.

Closes #55396
2022-08-17 08:28:01 -04:00
Alan Woodward
189f279b4f
Don't modify source map when parsing composite runtime field (#89114)
When calling RuntimeField.parseRuntimeFields() for fields defined in the
search request, we need to wrap the Map containing field definitions in another
Map that supports value removal, so that we don't inadvertently remove the
definitions from the root request. CompositeRuntimeField was not doing this
extra wrapping, which meant that requests that went to multiple shards and
that therefore parsed the definitions multiple times would throw an error
complaining that the fields parameter was missing, because the root request
had been modified.
2022-08-17 10:00:16 +01:00
Abdon Pijpelink
27061a530e
Revert "[DOCS] Update search_after section with an example (#89328)" (#89411)
Reverts elastic/elasticsearch#89328
2022-08-17 18:20:15 +09:30
Anthony McGlone
af8ac50788
[DOCS] Update search_after section with an example (#89328)
* [DOCS] Update search_after section with an example

* Update docs/reference/search/search-your-data/paginate-search-results.asciidoc

Co-authored-by: Abdon Pijpelink <abdon@abdon.nl>

* Update docs/reference/search/search-your-data/paginate-search-results.asciidoc

Co-authored-by: Abdon Pijpelink <abdon@abdon.nl>

* Update docs/reference/search/search-your-data/paginate-search-results.asciidoc

Co-authored-by: Abdon Pijpelink <abdon@abdon.nl>

Co-authored-by: Abdon Pijpelink <abdon@abdon.nl>
2022-08-17 09:53:14 +02:00
Abdon Pijpelink
f2257cae89
[DOCS] Adds note about escaping backslashes in regex (#89276)
* [DOCS] Adds note about escaping backslashes in regex

* Fix typo

* Simplify example
2022-08-17 09:40:30 +02:00
Jun Ohtani
c4dfc66ea2
[DOCS] Use CJKWidthCharFilter in JapaneseAnalyzer (#89364)
After Lucene 9.0, JapaneseAnalyzer uses CJKWidthCharFilter instead of
CJKWidthFilter.

See details https://issues.apache.org/jira/browse/LUCENE-9853

Co-authored-by: Julie Tibshirani <julietibs@apache.org>
2022-08-16 19:04:11 -07:00
Julie Tibshirani
acf9a67480
Document kNN with aggregations (#89359)
This commit adds a short note to the 'search your data' docs around kNN search
to explain how approximate kNN works with aggregations:
* Make section on 'hybrid retrieval' more general and include aggregations info
* Remove an example response from the previous section on filtering, since this
  page was getting long
2022-08-16 15:28:32 -07:00
Nikola Grcevski
dc672b0e65
Handle snapshot restore in file settings (#89321) 2022-08-16 17:18:18 -04:00
Nik Everett
82ad45f411
TSDB: Build _id without reparsing (#88789)
This replaces the code that build `_id` in tsid indices that used to
re-parse the entire json object with one that reuses the parsed values.
It speed up writes by about 4%. Here's the rally output:

```
|    Min Throughput |  8164.67 |  8547.24 | docs/s | +4.69% |
|   Mean Throughput |  8891.11 |  9256.75 | docs/s | +4.11% |
| Median Throughput |  8774.52 |  9134.15 | docs/s | +4.10% |
|    Max Throughput | 10246.7  | 10482.3  | docs/s | +2.30% |
```
2022-08-16 16:17:45 -04:00
Nikola Grcevski
5af8ec52fe
Support camel case dates on 7.x indices (#88914)
This adds back compatibility support for camel case dates
for 7.x indices used in 8.x.
2022-08-16 15:57:59 -04:00
Nik Everett
b327b17653
Fix shard splitting for nested (#89351)
I broke shard splitting when `_routing` is required and you use `nested`
docs. The mapping would look like this:
```
"mappings": {
  "_routing": {
    "required": true
  },
  "properties": {
    "n": { "type": "nested" }
  }
}
```

If you attempt to split an index with a mapping like this it'll blow up
with an exception like this:
```
Caused by: [idx] org.elasticsearch.action.RoutingMissingException: routing is required for [idx]/[0]
	at org.elasticsearch.cluster.routing.IndexRouting$IdAndRoutingOnly.checkRoutingRequired(IndexRouting.java:181)
	at org.elasticsearch.cluster.routing.IndexRouting$IdAndRoutingOnly.getShard(IndexRouting.java:175)
```

This fixes the problem by entirely avoiding the branch of code. That
branch was trying to find any top level documents that don't have a
`_routing`. But we *know* that there aren't any top level documents
without a routing in this case - the routing is "required". ES wouldn't
have let you index any top level documents without the routing.

This also adds a small pile of REST layer tests for shard splitting that
hit various branches in this area. For extra paranoia.

Closes #88109
2022-08-16 11:55:46 -04:00
Nik Everett
914e216ebd
Prepare synthetic source docs for tech-preview (#89358)
Now that we're releasing synthetic _source as a tech preview feature, we
no longer want to remove the docs from the non-release builds. And we
want to mark all of the headings describing synthetic `_source` as a
preview.
2022-08-16 10:05:45 -04:00
David Roberts
f87ce07138
[ML] Sync changelogs between 8.4 and main (#89377)
Copies a few changelog edits from the 8.4 branch into main so that
people looking at the main branch see the same docs as people
looking at 8.4.

Relates #89078
Relates #89286
Relates #89376
2022-08-16 11:12:00 +01:00
David Roberts
e4ff839e4c
[ML] Skip renormalization after node shutdown API called (#89347)
A node can be informed that it is about to be shut down
using the node shutdown API. When this happens we
gracefully stop the jobs on the node and they persist
state. This state persistence includes latest quantiles,
and usually receipt of new quantiles triggers a
renormalization. However, in the case of an impending
node shutdown we do not want to be kicking off new
processes that may delay the shutdown.

This PR changes the anomaly detection job results
processor so that it will not trigger a renormalization
based on quantiles received after a node shutdown message
is received.
2022-08-16 09:27:52 +01:00
Abdon Pijpelink
00d4953df5
[DOCS] Fixes broken example in pipeline tutorial (#89315) 2022-08-16 08:40:10 +02:00
Nik Everett
2569d1f08d
Docs: synthetic source doesn't dedupe numbers (#89355)
The docs for synthetic `_source` incorrectly claimed that synthetic
`_source` deduplicates numbers. It doesn't. The example below the prose
shows it *not* removing duplicates.
2022-08-16 07:28:46 +09:30
Nik Everett
081185071f
Enhance changelog for date_histogram speedup (#89353)
See #81322
2022-08-16 07:18:52 +09:30
Keith Massey
8360bf9a47
Fixing a version check for master stability functionality (#89322) 2022-08-15 09:43:35 -05:00
Yang Wang
098f5181c4
Double quote the env variable in curl command (#89279)
The env variable can contain special chacacters. Without quoting it
could mis-behave when used in the curl command of the setup docker
container.
2022-08-16 00:40:47 +10:00
Mayya Sharipova
10b804730d
Include runtime fields in total fields count (#89251)
We have a check that enforces the total number of fields needs to be below a
certain (configurable) threshold. Before runtime fields did not contribute
to the count. This patch makes all runtime fields contribute to the
count, runtime fields:
- that were explicitly defined in mapping by a user
- as well as runtime fields that were dynamically created by dynamic
 mappings

Closes #88265
2022-08-15 09:43:12 -04:00
David Turner
8d37d48426
Check circuit breaker before sending join request (#89318)
Adds a simple preflight check to `JoinHelper#sendJoinRequest` to avoid
sending a join request if it looks like the `inflight_requests` circuit
breaker is going to trip on the join validation message.

Closes #85003
2022-08-15 10:53:41 +01:00
David Turner
745947e854
Capture deprecation warnings in batched master tasks (#85525)
It's possible for a cluster state update task to emit deprecation
warnings, but if the task is executed in a batch then these warnings
will be exposed to the listener for every item in the batch. With this
commit we introduce a mechanism for tasks to capture just the warnings
relevant to them, along with assertions that warnings are not
inadvertently leaked back to the master service.

Closes #85506
2022-08-15 19:20:15 +09:30
David Turner
621c38cde5
Report better error for GCS credentials load failure (#89336)
Today if the GCS credentials file setting is invalid we report some kind
of JSON parsing error but it's not clear what JSON is being parsed so
the error is hard to track down. This commit adds the problematic
setting name to the exception message.
2022-08-15 19:12:50 +09:30
Keith Massey
5a26455170
Adding a check to the master stability health API when there is no master and the current node is not master eligible (#89219)
This PR builds on #86524, #87482, and #87306 by supporting the case where there has been no
master node in the last 30 second, no node has been elected master, and the current node is not
master eligible.
2022-08-12 08:28:31 -05:00
Abdon Pijpelink
e4c7febea1
Fix: Update geo-bounding-box-query.asciidoc (#87459) (#89301)
There are some redundant words so I just removed those words. Please accept this change.

(cherry picked from commit e1e5398051)

Co-authored-by: Adnan Ashraf <adnan.ashraff1@gmail.com>
2022-08-12 18:38:05 +09:30
Yang Wang
8dfbcd5c02
Limited-by role descriptors in Get/QueryApiKey response (#89273)
An API key's effective permission is an intersection between its
assigned role descriptors and a snapshot of its owner user's role
descriptors (limited-by role descriptors). In #89166, the assigned role
descriptors are now returned by default in Get/Query API key responses.

This PR further adds support to optionally return limited-by role
descriptors in the responses. Unlike assign role descriptors, an API key
cannot view any limited-by role descriptors unless it has manage_api_key
or higher privileges.

Relates: #89058
2022-08-12 15:47:49 +09:30
Yang Wang
96febb7d1a
Ensure secureString remain open when reloading secure settings (#88922)
The reloading secure settings action sends one node level request with
password (secureString) to each node. These node level requests share
the same secureString instance. This is not a problem when the requests
are sent across the wire because the secureString will end up to be
independent instances after de/serilization. But when the request is
handled by the local node, it skips the de/serialization process. This
means when the secureString gets closed, it is closed for all the node
level requests. If a node level request has not been sent across wire
when the secureString is closed under it, the serialization process will
result into error.

This PR fixes the bug by letting each Node level request creates a clone
of the secureString and have the Nodes level request to track all Node
level requests. All copies of secureString (on the coordinate node) will
be closed at Nodes request level which is safe because it is after
completion of all Node level requests.

Resolves: #88887
2022-08-12 15:31:35 +09:30
Hendrik Muhs
6c12fe0d67
[Transform] add an unattended mode setting to transform (#89212)
add an unattended mode setting. This will change how transform reacts on certain error types and lets transform run without failing.
2022-08-11 16:50:57 +02:00
Ignacio Vera
993e467615
Sort ranges in geo_distance aggregation (#89154)
This commit sorts ranges provided in a geo_distance aggregation, otherwise it fails to provided the right results if 
ranges are unordered.
2022-08-11 13:53:32 +02:00
Luca Belluccini
2d3bcc483d
[DOCS] Warn only one date format is added to the field date formats when using dynamic_date_formats (#88915)
* [DOCS] Warn only one date format is added to the field date formats

When using multiple options in `dynamic_date_formats`, only one of the formats of the first document having a date matching one of the date formats provided will be used.

E.g.
```
PUT my-index-000001
{
  "mappings": {
    "dynamic_date_formats": [ "yyyy/MM", "MM/dd/yyyy"]
  }
}

PUT my-index-000001/_doc/1
{
  "create_date": "09/25/2015"
}
```

The generated mappings will be:
```
    "mappings": {
      "dynamic_date_formats": [
        "yyyy/MM",
        "MM/dd/yyyy"
      ],
      "properties": {
        "create_date": {
          "type": "date",
          "format": "MM/dd/yyyy"
        }
      }
    },
```

Indexing a document with `2015/12` would lead to the `format` `"yyyy/MM"` being used for the `create_date`.

This can be misleading especially if the user is using multiple date formats on the same field.
The first document will determine the format of the `date` field being detected.

Maybe we should provide an additional example, such as:
```
PUT my-index-000001
{
  "mappings": {
    "dynamic_date_formats": [ "yyyy/MM||MM/dd/yyyy"]
  }
}
```

My wording is not great, so feel free to amend/edit.

* Update docs/reference/mapping/dynamic/field-mapping.asciidoc

Reword and add code example

* Turned discussion of the two syntaxes into an admonition

* Fix failing tests

Co-authored-by: Abdon Pijpelink <abdon.pijpelink@elastic.co>
2022-08-11 10:43:53 +02:00
David Turner
616fd07278
Drop transport client from ping_schedule docs (#89264)
The docs for `transport.ping_schedule` note that the transport client
defaults to a 5s ping schedule, but this is no longer relevant. This
commit drops this from the docs, and also moves the docs for this
setting further down the page to reflect its relative unimportance.
2022-08-11 09:25:14 +01:00
David Turner
0bf31b77fb
Fix message for stalled shutdown (#89254)
Today if a node shutdown is stalled due to unmoveable shards then we say
to use the allocation explain API to find details. In fact, since #78727
we include the allocation explanation in the response already so we
should tell users just to look at that instead. This commit adjusts the
message to address this.
2022-08-11 07:48:03 +01:00
Yoann Rodière
841ac8e43a
Upgrade Apache Commons Logging to 1.2 (#85745)
* Upgrade to Apache Commons Logging 1.2 (#40305)
* Clarify that Apache HTTP/commons-* dependencies are not just for tests
2022-08-10 13:19:15 -04:00
GabyCT
341f3b717a
[DOCS] Update URLs in plugin document (#89221)
This PR updates the URLs for several references that are being
used in the plugin document.

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2022-08-10 16:40:01 +02:00
David Turner
ceffaf9aad
Improve rejection of ambiguous voting config name (#89239)
Today if there are multiple nodes with the same name then
`POST /_cluster/voting_config_exclusions?node_names=ambiguous-name` will
return a `500 Internal Server Error` and a mysterious message. This
commit changes the behaviour to throw an `IllegalArgumentException`
(i.e. `400 Bad Request`) along with a more useful message describing the
problem.
2022-08-10 12:39:24 +01:00