-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support to _cluster/stats API for enabling/disabling mapping_stat…
…s and analysis_stats at request level. Signed-off-by: Swetha Guptha <[email protected]>
- Loading branch information
Swetha Guptha
committed
Aug 27, 2024
1 parent
ed65482
commit 5d8aacc
Showing
8 changed files
with
167 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...c/test/java/org/opensearch/action/admin/cluster/stats/ClusterStatsRequestBuilderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.action.admin.cluster.stats; | ||
|
||
import org.opensearch.test.OpenSearchTestCase; | ||
import org.opensearch.test.client.NoOpClient; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
|
||
public class ClusterStatsRequestBuilderTest extends OpenSearchTestCase { | ||
|
||
private NoOpClient testClient; | ||
|
||
@Override | ||
@Before | ||
public void setUp() throws Exception { | ||
super.setUp(); | ||
this.testClient = new NoOpClient(getTestName()); | ||
} | ||
|
||
@Override | ||
@After | ||
public void tearDown() throws Exception { | ||
this.testClient.close(); | ||
super.tearDown(); | ||
} | ||
|
||
public void testUseAggregatedNodeLevelResponses() { | ||
ClusterStatsRequestBuilder clusterStatsRequestBuilder = new ClusterStatsRequestBuilder( | ||
this.testClient, | ||
ClusterStatsAction.INSTANCE | ||
); | ||
clusterStatsRequestBuilder.useAggregatedNodeLevelResponses(false); | ||
assertFalse(clusterStatsRequestBuilder.request().useAggregatedNodeLevelResponses()); | ||
} | ||
|
||
public void testIncludeMappingStats() { | ||
ClusterStatsRequestBuilder clusterStatsRequestBuilder = new ClusterStatsRequestBuilder( | ||
this.testClient, | ||
ClusterStatsAction.INSTANCE | ||
); | ||
clusterStatsRequestBuilder.includeMappingStats(false); | ||
assertFalse(clusterStatsRequestBuilder.request().isIncludeMappingStats()); | ||
} | ||
|
||
public void testIncludeAnalysisStats() { | ||
ClusterStatsRequestBuilder clusterStatsRequestBuilder = new ClusterStatsRequestBuilder( | ||
this.testClient, | ||
ClusterStatsAction.INSTANCE | ||
); | ||
clusterStatsRequestBuilder.includeAnalysisStats(false); | ||
assertFalse(clusterStatsRequestBuilder.request().isIncludeAnalysisStats()); | ||
} | ||
} |