Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
[Remove] remaining type usage in Client and AbstractClient (opensearc…
Browse files Browse the repository at this point in the history
…h-project#2258)

Removes type parameter from remaining prepareIndex in Client and AbstractClient.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
  • Loading branch information
nknize authored Feb 25, 2022
1 parent 3a4c2f6 commit 0bd7850
Show file tree
Hide file tree
Showing 229 changed files with 1,911 additions and 1,515 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void testCustomWordDelimiterQueryString() {
.addMapping("type1", "field1", "type=text,analyzer=my_analyzer", "field2", "type=text,analyzer=my_analyzer")
);

client().prepareIndex("test", "type1", "1").setSource("field1", "foo bar baz", "field2", "not needed").get();
client().prepareIndex("test").setId("1").setSource("field1", "foo bar baz", "field2", "not needed").get();
refresh();

SearchResponse response = client().prepareSearch("test")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void testNgramHighlightingWithBrokenPositions() throws IOException {
.putList("analysis.analyzer.search_autocomplete.filter", "lowercase", "wordDelimiter")
)
);
client().prepareIndex("test", "test", "1").setSource("name", "ARCOTEL Hotels Deutschland").get();
client().prepareIndex("test").setId("1").setSource("name", "ARCOTEL Hotels Deutschland").get();
refresh();
SearchResponse search = client().prepareSearch("test")
.setQuery(matchQuery("name.autocomplete", "deut tel").operator(Operator.OR))
Expand Down Expand Up @@ -173,7 +173,8 @@ public void testMultiPhraseCutoff() throws IOException {
);

ensureGreen();
client().prepareIndex("test", "test", "1")
client().prepareIndex("test")
.setId("1")
.setSource(
"body",
"Test: http://www.facebook.com http://elasticsearch.org "
Expand Down Expand Up @@ -235,7 +236,7 @@ public void testSynonyms() throws IOException {
);
ensureGreen();

client().prepareIndex("test", "type1", "0").setSource("field1", "The quick brown fox jumps over the lazy dog").get();
client().prepareIndex("test").setId("0").setSource("field1", "The quick brown fox jumps over the lazy dog").get();
refresh();
for (String highlighterType : new String[] { "plain", "fvh", "unified" }) {
logger.info("--> highlighting (type=" + highlighterType + ") and searching on field1");
Expand Down Expand Up @@ -263,10 +264,12 @@ public void testPhrasePrefix() throws IOException {

ensureGreen();

client().prepareIndex("first_test_index", "type1", "0")
client().prepareIndex("first_test_index")
.setId("0")
.setSource("field0", "The quick brown fox jumps over the lazy dog", "field1", "The quick brown fox jumps over the lazy dog")
.get();
client().prepareIndex("first_test_index", "type1", "1")
client().prepareIndex("first_test_index")
.setId("1")
.setSource("field1", "The quick browse button is a fancy thing, right bro?")
.get();
refresh();
Expand Down Expand Up @@ -344,7 +347,8 @@ public void testPhrasePrefix() throws IOException {
)
);
// with synonyms
client().prepareIndex("second_test_index", "doc", "0")
client().prepareIndex("second_test_index")
.setId("0")
.setSource(
"type",
"type2",
Expand All @@ -354,10 +358,11 @@ public void testPhrasePrefix() throws IOException {
"The quick brown fox jumps over the lazy dog"
)
.get();
client().prepareIndex("second_test_index", "doc", "1")
client().prepareIndex("second_test_index")
.setId("1")
.setSource("type", "type2", "field4", "The quick browse button is a fancy thing, right bro?")
.get();
client().prepareIndex("second_test_index", "doc", "2").setSource("type", "type2", "field4", "a quick fast blue car").get();
client().prepareIndex("second_test_index").setId("2").setSource("type", "type2", "field4", "a quick fast blue car").get();
refresh();

source = searchSource().postFilter(termQuery("type", "type2"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,17 @@ public Settings onNodeStopped(String nodeName) {
checkPipelineExists.accept(pipelineIdWithoutScript);
checkPipelineExists.accept(pipelineIdWithScript);

client().prepareIndex("index", "doc", "1")
client().prepareIndex("index")
.setId("1")
.setSource("x", 0)
.setPipeline(pipelineIdWithoutScript)
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
.get();

IllegalStateException exception = expectThrows(
IllegalStateException.class,
() -> client().prepareIndex("index", "doc", "2")
() -> client().prepareIndex("index")
.setId("2")
.setSource("x", 0)
.setPipeline(pipelineIdWithScript)
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
Expand Down Expand Up @@ -236,7 +238,8 @@ public void testPipelineWithScriptProcessorThatHasStoredScript() throws Exceptio
);
client().admin().cluster().preparePutPipeline("_id", pipeline, XContentType.JSON).get();

client().prepareIndex("index", "doc", "1")
client().prepareIndex("index")
.setId("1")
.setSource("x", 0)
.setPipeline("_id")
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
Expand All @@ -254,7 +257,8 @@ public void testPipelineWithScriptProcessorThatHasStoredScript() throws Exceptio
internalCluster().fullRestart();
ensureYellow("index");

client().prepareIndex("index", "doc", "2")
client().prepareIndex("index")
.setId("2")
.setSource("x", 0)
.setPipeline("_id")
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
Expand All @@ -275,7 +279,8 @@ public void testWithDedicatedIngestNode() throws Exception {
);
client().admin().cluster().preparePutPipeline("_id", pipeline, XContentType.JSON).get();

client().prepareIndex("index", "doc", "1")
client().prepareIndex("index")
.setId("1")
.setSource("x", 0)
.setPipeline("_id")
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
Expand All @@ -288,7 +293,8 @@ public void testWithDedicatedIngestNode() throws Exception {
logger.info("Stopping");
internalCluster().restartNode(node, new InternalTestCluster.RestartCallback());

client(ingestNode).prepareIndex("index", "doc", "2")
client(ingestNode).prepareIndex("index")
.setId("2")
.setSource("x", 0)
.setPipeline("_id")
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
Expand Down
Loading

0 comments on commit 0bd7850

Please sign in to comment.