Skip to content

Commit 6037c8b

Browse files
committed
Merge branch 'master' into xpack-license
* master: DOCS Audit event attributes in new format (elastic#35510) Scripting: Actually add joda time back to whitelist (elastic#35965) [DOCS] fix HLRC ILM doc misreferenced tag Add realm information for Authenticate API (elastic#35648) [ILM] add HLRC docs to remove-policy-from-index (elastic#35759) [Rollup] Update serialization version after backport [Rollup] Add more diagnostic stats to job (elastic#35471) Build: Fix gradle build for Mac OS (elastic#35968) Adds deprecation logging to ScriptDocValues#getValues. (elastic#34279) [Monitoring] Make Exporters Async (elastic#35765) [ILM] reduce time restriction on IndexLifecycleExplainResponse (elastic#35954) Remove use of AbstractComponent in xpack (elastic#35394) Deprecate types in search and multi search templates. (elastic#35669) Remove fromXContent from IndexUpgradeInfoResponse (elastic#35934)
2 parents 4a7c161 + 36819f7 commit 6037c8b

File tree

135 files changed

+3000
-1439
lines changed

Some content is hidden

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

135 files changed

+3000
-1439
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ class BuildPlugin implements Plugin<Project> {
910910
args '-n', 'hw.physicalcpu'
911911
standardOutput = stdout
912912
}
913-
return stdout.toString('UTF-8')
913+
return stdout.toString('UTF-8').trim();
914914
}
915915
return 'auto';
916916
}

client/rest-high-level/src/main/java/org/elasticsearch/client/indexlifecycle/IndexLifecycleExplainResponse.java

+3-6
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,12 @@ private IndexLifecycleExplainResponse(String index, boolean managedByILM, String
124124
throw new IllegalArgumentException("[" + POLICY_NAME_FIELD.getPreferredName() + "] cannot be null for managed index");
125125
}
126126
// check to make sure that step details are either all null or all set.
127-
long numNull = Stream.of(phase, action, step, phaseTime, actionTime, stepTime).filter(Objects::isNull).count();
128-
if (numNull > 0 && numNull < 6) {
127+
long numNull = Stream.of(phase, action, step).filter(Objects::isNull).count();
128+
if (numNull > 0 && numNull < 3) {
129129
throw new IllegalArgumentException("managed index response must have complete step details [" +
130130
PHASE_FIELD.getPreferredName() + "=" + phase + ", " +
131-
PHASE_TIME_FIELD.getPreferredName() + "=" + phaseTime + ", " +
132131
ACTION_FIELD.getPreferredName() + "=" + action + ", " +
133-
ACTION_TIME_FIELD.getPreferredName() + "=" + actionTime + ", " +
134-
STEP_FIELD.getPreferredName() + "=" + step + ", " +
135-
STEP_TIME_FIELD.getPreferredName() + "=" + stepTime + "]");
132+
STEP_FIELD.getPreferredName() + "=" + step + "]");
136133
}
137134
} else {
138135
if (policyName != null || lifecycleDate != null || phase != null || action != null || step != null || failedStep != null

client/rest-high-level/src/main/java/org/elasticsearch/client/rollup/GetRollupJobResponse.java

+93-11
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@
2626
import org.elasticsearch.common.xcontent.XContentParser;
2727

2828
import java.io.IOException;
29-
import java.util.Objects;
3029
import java.util.List;
3130
import java.util.Locale;
3231
import java.util.Map;
32+
import java.util.Objects;
3333

34-
import static org.elasticsearch.common.xcontent.ConstructingObjectParser.constructorArg;
35-
import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg;
3634
import static java.util.Collections.unmodifiableList;
3735
import static java.util.stream.Collectors.joining;
36+
import static org.elasticsearch.common.xcontent.ConstructingObjectParser.constructorArg;
37+
import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg;
3838

3939
/**
4040
* Response from rollup's get jobs api.
@@ -51,6 +51,12 @@ public class GetRollupJobResponse {
5151
static final ParseField STATE = new ParseField("job_state");
5252
static final ParseField CURRENT_POSITION = new ParseField("current_position");
5353
static final ParseField UPGRADED_DOC_ID = new ParseField("upgraded_doc_id");
54+
static final ParseField INDEX_TIME_IN_MS = new ParseField("index_time_in_ms");
55+
static final ParseField SEARCH_TIME_IN_MS = new ParseField("search_time_in_ms");
56+
static final ParseField INDEX_TOTAL = new ParseField("index_total");
57+
static final ParseField SEARCH_TOTAL = new ParseField("search_total");
58+
static final ParseField SEARCH_FAILURES = new ParseField("search_failures");
59+
static final ParseField INDEX_FAILURES = new ParseField("index_failures");
5460

5561
private List<JobWrapper> jobs;
5662

@@ -181,12 +187,25 @@ public static class RollupIndexerJobStats {
181187
private final long numInputDocuments;
182188
private final long numOuputDocuments;
183189
private final long numInvocations;
184-
185-
RollupIndexerJobStats(long numPages, long numInputDocuments, long numOuputDocuments, long numInvocations) {
190+
private long indexTime;
191+
private long indexTotal;
192+
private long searchTime;
193+
private long searchTotal;
194+
private long indexFailures;
195+
private long searchFailures;
196+
197+
RollupIndexerJobStats(long numPages, long numInputDocuments, long numOuputDocuments, long numInvocations,
198+
long indexTime, long indexTotal, long searchTime, long searchTotal, long indexFailures, long searchFailures) {
186199
this.numPages = numPages;
187200
this.numInputDocuments = numInputDocuments;
188201
this.numOuputDocuments = numOuputDocuments;
189202
this.numInvocations = numInvocations;
203+
this.indexTime = indexTime;
204+
this.indexTotal = indexTotal;
205+
this.searchTime = searchTime;
206+
this.searchTotal = searchTotal;
207+
this.indexFailures = indexFailures;
208+
this.searchFailures = searchFailures;
190209
}
191210

192211
/**
@@ -217,15 +236,65 @@ public long getOutputDocuments() {
217236
return numOuputDocuments;
218237
}
219238

239+
/**
240+
* Number of failures that have occurred during the bulk indexing phase of Rollup
241+
*/
242+
public long getIndexFailures() {
243+
return indexFailures;
244+
}
245+
246+
/**
247+
* Number of failures that have occurred during the search phase of Rollup
248+
*/
249+
public long getSearchFailures() {
250+
return searchFailures;
251+
}
252+
253+
/**
254+
* Returns the time spent indexing (cumulative) in milliseconds
255+
*/
256+
public long getIndexTime() {
257+
return indexTime;
258+
}
259+
260+
/**
261+
* Returns the time spent searching (cumulative) in milliseconds
262+
*/
263+
public long getSearchTime() {
264+
return searchTime;
265+
}
266+
267+
/**
268+
* Returns the total number of indexing requests that have been sent by the rollup job
269+
* (Note: this is not the number of _documents_ that have been indexed)
270+
*/
271+
public long getIndexTotal() {
272+
return indexTotal;
273+
}
274+
275+
/**
276+
* Returns the total number of search requests that have been sent by the rollup job
277+
*/
278+
public long getSearchTotal() {
279+
return searchTotal;
280+
}
281+
220282
private static final ConstructingObjectParser<RollupIndexerJobStats, Void> PARSER = new ConstructingObjectParser<>(
221283
STATS.getPreferredName(),
222284
true,
223-
args -> new RollupIndexerJobStats((long) args[0], (long) args[1], (long) args[2], (long) args[3]));
285+
args -> new RollupIndexerJobStats((long) args[0], (long) args[1], (long) args[2], (long) args[3],
286+
(long) args[4], (long) args[5], (long) args[6], (long) args[7], (long) args[8], (long) args[9]));
224287
static {
225288
PARSER.declareLong(constructorArg(), NUM_PAGES);
226289
PARSER.declareLong(constructorArg(), NUM_INPUT_DOCUMENTS);
227290
PARSER.declareLong(constructorArg(), NUM_OUTPUT_DOCUMENTS);
228291
PARSER.declareLong(constructorArg(), NUM_INVOCATIONS);
292+
PARSER.declareLong(constructorArg(), INDEX_TIME_IN_MS);
293+
PARSER.declareLong(constructorArg(), INDEX_TOTAL);
294+
PARSER.declareLong(constructorArg(), SEARCH_TIME_IN_MS);
295+
PARSER.declareLong(constructorArg(), SEARCH_TOTAL);
296+
PARSER.declareLong(constructorArg(), INDEX_FAILURES);
297+
PARSER.declareLong(constructorArg(), SEARCH_FAILURES);
229298
}
230299

231300
@Override
@@ -234,22 +303,35 @@ public boolean equals(Object other) {
234303
if (other == null || getClass() != other.getClass()) return false;
235304
RollupIndexerJobStats that = (RollupIndexerJobStats) other;
236305
return Objects.equals(this.numPages, that.numPages)
237-
&& Objects.equals(this.numInputDocuments, that.numInputDocuments)
238-
&& Objects.equals(this.numOuputDocuments, that.numOuputDocuments)
239-
&& Objects.equals(this.numInvocations, that.numInvocations);
306+
&& Objects.equals(this.numInputDocuments, that.numInputDocuments)
307+
&& Objects.equals(this.numOuputDocuments, that.numOuputDocuments)
308+
&& Objects.equals(this.numInvocations, that.numInvocations)
309+
&& Objects.equals(this.indexTime, that.indexTime)
310+
&& Objects.equals(this.searchTime, that.searchTime)
311+
&& Objects.equals(this.indexFailures, that.indexFailures)
312+
&& Objects.equals(this.searchFailures, that.searchFailures)
313+
&& Objects.equals(this.searchTotal, that.searchTotal)
314+
&& Objects.equals(this.indexTotal, that.indexTotal);
240315
}
241316

242317
@Override
243318
public int hashCode() {
244-
return Objects.hash(numPages, numInputDocuments, numOuputDocuments, numInvocations);
319+
return Objects.hash(numPages, numInputDocuments, numOuputDocuments, numInvocations,
320+
indexTime, searchTime, indexFailures, searchFailures, searchTotal, indexTotal);
245321
}
246322

247323
@Override
248324
public final String toString() {
249325
return "{pages=" + numPages
250326
+ ", input_docs=" + numInputDocuments
251327
+ ", output_docs=" + numOuputDocuments
252-
+ ", invocations=" + numInvocations + "}";
328+
+ ", invocations=" + numInvocations
329+
+ ", index_failures=" + indexFailures
330+
+ ", search_failures=" + searchFailures
331+
+ ", index_time_in_ms=" + indexTime
332+
+ ", index_total=" + indexTotal
333+
+ ", search_time_in_ms=" + searchTime
334+
+ ", search_total=" + searchTotal+ "}";
253335
}
254336
}
255337

client/rest-high-level/src/main/java/org/elasticsearch/client/security/AuthenticateResponse.java

+71-11
Original file line numberDiff line numberDiff line change
@@ -46,27 +46,43 @@ public final class AuthenticateResponse {
4646
static final ParseField FULL_NAME = new ParseField("full_name");
4747
static final ParseField EMAIL = new ParseField("email");
4848
static final ParseField ENABLED = new ParseField("enabled");
49+
static final ParseField AUTHENTICATION_REALM = new ParseField("authentication_realm");
50+
static final ParseField LOOKUP_REALM = new ParseField("lookup_realm");
51+
static final ParseField REALM_NAME = new ParseField("name");
52+
static final ParseField REALM_TYPE = new ParseField("type");
4953

5054
@SuppressWarnings("unchecked")
5155
private static final ConstructingObjectParser<AuthenticateResponse, Void> PARSER = new ConstructingObjectParser<>(
5256
"client_security_authenticate_response",
5357
a -> new AuthenticateResponse(new User((String) a[0], ((List<String>) a[1]), (Map<String, Object>) a[2],
54-
(String) a[3], (String) a[4]), (Boolean) a[5]));
58+
(String) a[3], (String) a[4]), (Boolean) a[5], (RealmInfo) a[6], (RealmInfo) a[7]));
5559
static {
60+
final ConstructingObjectParser<RealmInfo, Void> realmInfoParser = new ConstructingObjectParser<>("realm_info",
61+
a -> new RealmInfo((String) a[0], (String) a[1]));
62+
realmInfoParser.declareString(constructorArg(), REALM_NAME);
63+
realmInfoParser.declareString(constructorArg(), REALM_TYPE);
5664
PARSER.declareString(constructorArg(), USERNAME);
5765
PARSER.declareStringArray(constructorArg(), ROLES);
5866
PARSER.<Map<String, Object>>declareObject(constructorArg(), (parser, c) -> parser.map(), METADATA);
5967
PARSER.declareStringOrNull(optionalConstructorArg(), FULL_NAME);
6068
PARSER.declareStringOrNull(optionalConstructorArg(), EMAIL);
6169
PARSER.declareBoolean(constructorArg(), ENABLED);
70+
PARSER.declareObject(constructorArg(), realmInfoParser, AUTHENTICATION_REALM);
71+
PARSER.declareObject(constructorArg(), realmInfoParser, LOOKUP_REALM);
6272
}
6373

6474
private final User user;
6575
private final boolean enabled;
76+
private final RealmInfo authenticationRealm;
77+
private final RealmInfo lookupRealm;
6678

67-
public AuthenticateResponse(User user, boolean enabled) {
79+
80+
public AuthenticateResponse(User user, boolean enabled, RealmInfo authenticationRealm,
81+
RealmInfo lookupRealm) {
6882
this.user = user;
6983
this.enabled = enabled;
84+
this.authenticationRealm = authenticationRealm;
85+
this.lookupRealm = lookupRealm;
7086
}
7187

7288
/**
@@ -85,25 +101,69 @@ public boolean enabled() {
85101
return enabled;
86102
}
87103

104+
/**
105+
* @return the realm that authenticated the user
106+
*/
107+
public RealmInfo getAuthenticationRealm() {
108+
return authenticationRealm;
109+
}
110+
111+
/**
112+
* @return the realm where the user information was looked up
113+
*/
114+
public RealmInfo getLookupRealm() {
115+
return lookupRealm;
116+
}
117+
88118
@Override
89119
public boolean equals(Object o) {
90-
if (this == o) {
91-
return true;
92-
}
93-
if (o == null || getClass() != o.getClass()) {
94-
return false;
95-
}
96-
final AuthenticateResponse that = (AuthenticateResponse) o;
97-
return user.equals(that.user) && enabled == that.enabled;
120+
if (this == o) return true;
121+
if (o == null || getClass() != o.getClass()) return false;
122+
AuthenticateResponse that = (AuthenticateResponse) o;
123+
return enabled == that.enabled &&
124+
Objects.equals(user, that.user) &&
125+
Objects.equals(authenticationRealm, that.authenticationRealm) &&
126+
Objects.equals(lookupRealm, that.lookupRealm);
98127
}
99128

100129
@Override
101130
public int hashCode() {
102-
return Objects.hash(user, enabled);
131+
return Objects.hash(user, enabled, authenticationRealm, lookupRealm);
103132
}
104133

105134
public static AuthenticateResponse fromXContent(XContentParser parser) throws IOException {
106135
return PARSER.parse(parser, null);
107136
}
108137

138+
public static class RealmInfo {
139+
private String name;
140+
private String type;
141+
142+
RealmInfo(String name, String type) {
143+
this.name = name;
144+
this.type = type;
145+
}
146+
147+
public String getName() {
148+
return name;
149+
}
150+
151+
public String getType() {
152+
return type;
153+
}
154+
155+
@Override
156+
public boolean equals(Object o) {
157+
if (this == o) return true;
158+
if (o == null || getClass() != o.getClass()) return false;
159+
RealmInfo realmInfo = (RealmInfo) o;
160+
return Objects.equals(name, realmInfo.name) &&
161+
Objects.equals(type, realmInfo.type);
162+
}
163+
164+
@Override
165+
public int hashCode() {
166+
return Objects.hash(name, type);
167+
}
168+
}
109169
}

0 commit comments

Comments
 (0)