Skip to content

Commit 266212a

Browse files
Merge branch 'main' into fixElasticsearchServiceBug
2 parents ba08f82 + fad0d2a commit 266212a

File tree

56 files changed

+1808
-561
lines changed

Some content is hidden

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

56 files changed

+1808
-561
lines changed

docs/changelog/114168.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 114168
2+
summary: Add a query rules tester API call
3+
area: Relevance
4+
type: enhancement
5+
issues: []

docs/changelog/114549.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 114549
2+
summary: Send mid-stream errors to users
3+
area: Machine Learning
4+
type: bug
5+
issues: []

docs/changelog/114715.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 114715
2+
summary: Ignore unrecognized openai sse fields
3+
area: Machine Learning
4+
type: bug
5+
issues: []

docs/reference/esql/processing-commands/where.asciidoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
The `WHERE` processing command produces a table that contains all the rows from
66
the input table for which the provided condition evaluates to `true`.
77

8+
[TIP]
9+
====
10+
In case of value exclusions, fields with `null` values will be excluded from search results.
11+
In this context a `null` means either there is an explicit `null` value in the document or there is no value at all.
12+
For example: `WHERE field != "value"` will be interpreted as `WHERE field != "value" AND field IS NOT NULL`.
13+
====
14+
815
**Syntax**
916

1017
[source,esql]

docs/reference/query-rules/apis/index.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Use the following APIs to manage query rulesets:
2323
* <<put-query-rule>>
2424
* <<get-query-rule>>
2525
* <<delete-query-rule>>
26+
* preview:[] <<test-query-ruleset>>
2627

2728
include::put-query-ruleset.asciidoc[]
2829
include::get-query-ruleset.asciidoc[]
@@ -31,4 +32,5 @@ include::delete-query-ruleset.asciidoc[]
3132
include::put-query-rule.asciidoc[]
3233
include::get-query-rule.asciidoc[]
3334
include::delete-query-rule.asciidoc[]
35+
include::test-query-ruleset.asciidoc[]
3436

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
[role="xpack"]
2+
[[test-query-ruleset]]
3+
=== Test query ruleset
4+
5+
++++
6+
<titleabbrev>Tests query ruleset</titleabbrev>
7+
++++
8+
9+
Evaluates match criteria against a query ruleset to identify the rules that would match that criteria.
10+
11+
preview::[]
12+
13+
[[test-query-ruleset-request]]
14+
==== {api-request-title}
15+
16+
`POST _query_rules/<ruleset_id>/_test`
17+
18+
[[test-query-ruleset-prereq]]
19+
==== {api-prereq-title}
20+
21+
Requires the `manage_search_query_rules` privilege.
22+
23+
[[test-query-ruleset-path-params]]
24+
==== {api-path-parms-title}
25+
26+
`<ruleset_id>`::
27+
(Required, string)
28+
29+
[[test-query-rule-request-body]]
30+
==== {api-request-body-title}
31+
32+
`match_criteria`::
33+
(Required, object) Defines the match criteria to apply to rules in the given query ruleset.
34+
Match criteria should match the keys defined in the `criteria.metadata` field of the rule.
35+
36+
[[test-query-ruleset-response-codes]]
37+
==== {api-response-codes-title}
38+
39+
`400`::
40+
The `ruleset_id` or `match_criteria` were not provided.
41+
42+
`404` (Missing resources)::
43+
No query ruleset matching `ruleset_id` could be found.
44+
45+
[[test-query-ruleset-example]]
46+
==== {api-examples-title}
47+
48+
To test a ruleset, provide the match criteria that you want to test against:
49+
50+
////
51+
52+
[source,console]
53+
--------------------------------------------------
54+
PUT _query_rules/my-ruleset
55+
{
56+
"rules": [
57+
{
58+
"rule_id": "my-rule1",
59+
"type": "pinned",
60+
"criteria": [
61+
{
62+
"type": "contains",
63+
"metadata": "query_string",
64+
"values": [ "pugs", "puggles" ]
65+
}
66+
],
67+
"actions": {
68+
"ids": [
69+
"id1",
70+
"id2"
71+
]
72+
}
73+
},
74+
{
75+
"rule_id": "my-rule2",
76+
"type": "pinned",
77+
"criteria": [
78+
{
79+
"type": "fuzzy",
80+
"metadata": "query_string",
81+
"values": [ "rescue dogs" ]
82+
}
83+
],
84+
"actions": {
85+
"docs": [
86+
{
87+
"_index": "index1",
88+
"_id": "id3"
89+
},
90+
{
91+
"_index": "index2",
92+
"_id": "id4"
93+
}
94+
]
95+
}
96+
}
97+
]
98+
}
99+
--------------------------------------------------
100+
// TESTSETUP
101+
102+
[source,console]
103+
--------------------------------------------------
104+
DELETE _query_rules/my-ruleset
105+
--------------------------------------------------
106+
// TEARDOWN
107+
108+
////
109+
110+
[source,console]
111+
----
112+
POST _query_rules/my-ruleset/_test
113+
{
114+
"match_criteria": {
115+
"query_string": "puggles"
116+
}
117+
}
118+
----
119+
120+
A sample response:
121+
122+
[source,console-result]
123+
----
124+
{
125+
"total_matched_rules": 1,
126+
"matched_rules": [
127+
{
128+
"ruleset_id": "my-ruleset",
129+
"rule_id": "my-rule1"
130+
}
131+
]
132+
}
133+
----

muted-tests.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,15 @@ tests:
369369
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
370370
method: test {yaml=reference/rest-api/usage/line_38}
371371
issue: https://github.com/elastic/elasticsearch/issues/113694
372+
- class: org.elasticsearch.xpack.enrich.EnrichRestIT
373+
method: test {p0=enrich/10_basic/Test using the deprecated elasticsearch_version field results in a warning}
374+
issue: https://github.com/elastic/elasticsearch/issues/114748
375+
- class: org.elasticsearch.xpack.eql.EqlRestIT
376+
method: testIndexWildcardPatterns
377+
issue: https://github.com/elastic/elasticsearch/issues/114749
378+
- class: org.elasticsearch.xpack.eql.EqlRestIT
379+
method: testBadRequests
380+
issue: https://github.com/elastic/elasticsearch/issues/114752
372381

373382
# Examples:
374383
#
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"query_rules.test": {
3+
"documentation": {
4+
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/test-query-ruleset.html",
5+
"description": "Tests a query ruleset to identify the rules that would match input criteria"
6+
},
7+
"stability": "experimental",
8+
"visibility": "public",
9+
"headers": {
10+
"accept": [
11+
"application/json"
12+
],
13+
"content_type": [
14+
"application/json"
15+
]
16+
},
17+
"url": {
18+
"paths": [
19+
{
20+
"path": "/_query_rules/{ruleset_id}/_test",
21+
"methods": [
22+
"POST"
23+
],
24+
"parts": {
25+
"ruleset_id": {
26+
"type": "string",
27+
"description": "The unique identifier of the ruleset to test."
28+
}
29+
}
30+
}
31+
]
32+
},
33+
"body": {
34+
"description": "The match criteria to test against the ruleset",
35+
"required": true
36+
}
37+
}
38+
}

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ static TransportVersion def(int id) {
242242
public static final TransportVersion ESQL_CACHED_STRING_SERIALIZATION = def(8_766_00_0);
243243
public static final TransportVersion CHUNK_SENTENCE_OVERLAP_SETTING_ADDED = def(8_767_00_0);
244244
public static final TransportVersion OPT_IN_ESQL_CCS_EXECUTION_INFO = def(8_768_00_0);
245+
public static final TransportVersion QUERY_RULE_TEST_API = def(8_769_00_0);
245246

246247
/*
247248
* STOP! READ THIS FIRST! No, really,

0 commit comments

Comments
 (0)