Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
94d7e14
Remove types from bulk request
romseygeek Sep 23, 2019
b6f94f7
Merge remote-tracking branch 'origin/master' into types-removal/bulk-…
romseygeek Sep 23, 2019
1f538a3
tests
romseygeek Sep 23, 2019
748d1f6
tests
romseygeek Sep 23, 2019
9ba9c59
tests
romseygeek Sep 23, 2019
e63d109
tests
romseygeek Sep 24, 2019
f03a740
compilation; remove type from BulkResponse.Failure
romseygeek Sep 24, 2019
e8d9158
tests
romseygeek Sep 25, 2019
daee751
bulk monitoring
romseygeek Sep 25, 2019
842ecfd
imports
romseygeek Sep 25, 2019
d47c63a
Merge remote-tracking branch 'origin/master' into types-removal/bulk-…
romseygeek Sep 25, 2019
45c6f5e
bulk tests
romseygeek Sep 25, 2019
100019d
tests
romseygeek Sep 25, 2019
fdabe48
monitoring again
romseygeek Sep 25, 2019
9779d9b
sake
romseygeek Sep 25, 2019
4345c6a
yaml test
romseygeek Sep 26, 2019
946c313
assertions
romseygeek Sep 26, 2019
5c2950f
yaml test
romseygeek Sep 26, 2019
ca03935
wtf
romseygeek Sep 26, 2019
7863b64
Merge branch 'master' into types-removal/bulk-request-action
romseygeek Sep 26, 2019
9baf0f5
relax assertion
romseygeek Sep 26, 2019
3b13ca2
Merge remote-tracking branch 'romseygeek/types-removal/bulk-request-a…
romseygeek Sep 26, 2019
db1e223
Remove types from DocWriteRequest/IndexResponse
romseygeek Sep 26, 2019
219504f
Merge remote-tracking branch 'origin/master' into types-removal/doc-w…
romseygeek Oct 7, 2019
d5d878f
tests
romseygeek Oct 7, 2019
d280f75
test failures
romseygeek Oct 7, 2019
25a5bf4
imports
romseygeek Oct 7, 2019
b724b44
rest handler
romseygeek Oct 7, 2019
b0a0687
Merge remote-tracking branch 'origin/master' into types-removal/doc-w…
romseygeek Oct 7, 2019
9b97d95
Workaround for weird SLM failure
romseygeek Oct 8, 2019
1ab2ac1
tests
romseygeek Oct 8, 2019
64abbcc
tests
romseygeek Oct 8, 2019
4a61b4b
tests
romseygeek Oct 8, 2019
55fb4c4
Merge remote-tracking branch 'origin/master' into types-removal/doc-w…
romseygeek Oct 8, 2019
d34189f
bats
romseygeek Oct 8, 2019
75d3c8e
tests
romseygeek Oct 8, 2019
8111bf9
Remove IndexRequestBuilder.setType() - requires docwriterequest chang…
romseygeek Oct 8, 2019
aaeb7e7
Client.prepareIndex(index, type) -> Client.prepareIndex(index)
romseygeek Oct 9, 2019
b2dee1f
javadocs
romseygeek Oct 12, 2019
b634c3f
Remove type from Client.prepareUpdate()
romseygeek Oct 12, 2019
beb5ea5
Remove type from Client.prepareDelete()
romseygeek Oct 12, 2019
8e505e0
Merge remote-tracking branch 'origin/master' into types-removal/prepa…
romseygeek Oct 17, 2019
d9a649c
compilation
romseygeek Oct 17, 2019
ff13c5b
Remove setType() from URBuilder and DRBuilder
romseygeek Oct 17, 2019
0c2301f
Merge remote-tracking branch 'origin/master' into types-removal/prepa…
romseygeek Oct 17, 2019
3f43081
tests
romseygeek Oct 17, 2019
3485fcf
Merge branch 'master' into types-removal/prepare-index
elasticmachine Oct 18, 2019
391114e
Merge branch 'master' into types-removal/prepare-index
elasticmachine Oct 20, 2019
6b2216a
Merge branch 'master' into types-removal/prepare-index
elasticmachine Oct 21, 2019
440aef4
Merge branch 'master' into types-removal/prepare-index
elasticmachine Oct 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,6 @@ public void testInvalidUpdateScript() throws Exception {
ensureGreen("test_index");
indexRandom(true, client().prepareIndex("test_index", "doc", "1").setSource("text_field", "text"));
UpdateRequestBuilder urb = client().prepareUpdate().setIndex("test_index");
urb.setType("doc");
urb.setId("1");
urb.setScript(new Script(ScriptType.INLINE, ExpressionScriptEngine.NAME, "0", Collections.emptyMap()));
urb.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void testAllOpsDisabledIndexedScripts() throws IOException {
.get();
client().prepareIndex("test", "scriptTest", "1").setSource("{\"theField\":\"foo\"}", XContentType.JSON).get();
try {
client().prepareUpdate("test", "scriptTest", "1")
client().prepareUpdate("test", "1")
.setScript(new Script(ScriptType.STORED, null, "script1", Collections.emptyMap())).get();
fail("update script should have been rejected");
} catch(Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public void testWithDeletes() throws Exception {
* the updates cause that.
*/
UpdateResponse updateResponse;
updateResponse = client().prepareUpdate(indexName, "doc", idToUpdate)
updateResponse = client().prepareUpdate(indexName, idToUpdate)
.setRouting("1")
.setDoc(Requests.INDEX_CONTENT_TYPE, "count", 1)
.setDetectNoop(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ public void testParentChildQueriesCanHandleNoRelevantTypesInIndex() throws Excep
assertNoFailures(response);
assertThat(response.getHits().getTotalHits().value, equalTo(0L));

client().prepareIndex("test", "doc").setSource(jsonBuilder().startObject().field("text", "value").endObject())
client().prepareIndex("test").setSource(jsonBuilder().startObject().field("text", "value").endObject())
.setRefreshPolicy(RefreshPolicy.IMMEDIATE).get();

response = client().prepareSearch("test")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.index.IndexNotFoundException;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.index.query.MatchAllQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.rankeval.PrecisionAtK.Detail;
Expand Down Expand Up @@ -61,21 +60,21 @@ public void setup() {
createIndex(TEST_INDEX);
ensureGreen();

client().prepareIndex(TEST_INDEX, MapperService.SINGLE_MAPPING_NAME).setId("1")
client().prepareIndex(TEST_INDEX).setId("1")
.setSource("text", "berlin", "title", "Berlin, Germany", "population", 3670622).get();
client().prepareIndex(TEST_INDEX, MapperService.SINGLE_MAPPING_NAME).setId("2").setSource("text", "amsterdam", "population", 851573)
client().prepareIndex(TEST_INDEX).setId("2").setSource("text", "amsterdam", "population", 851573)
.get();
client().prepareIndex(TEST_INDEX, MapperService.SINGLE_MAPPING_NAME).setId("3").setSource("text", "amsterdam", "population", 851573)
client().prepareIndex(TEST_INDEX).setId("3").setSource("text", "amsterdam", "population", 851573)
.get();
client().prepareIndex(TEST_INDEX, MapperService.SINGLE_MAPPING_NAME).setId("4").setSource("text", "amsterdam", "population", 851573)
client().prepareIndex(TEST_INDEX).setId("4").setSource("text", "amsterdam", "population", 851573)
.get();
client().prepareIndex(TEST_INDEX, MapperService.SINGLE_MAPPING_NAME).setId("5").setSource("text", "amsterdam", "population", 851573)
client().prepareIndex(TEST_INDEX).setId("5").setSource("text", "amsterdam", "population", 851573)
.get();
client().prepareIndex(TEST_INDEX, MapperService.SINGLE_MAPPING_NAME).setId("6").setSource("text", "amsterdam", "population", 851573)
client().prepareIndex(TEST_INDEX).setId("6").setSource("text", "amsterdam", "population", 851573)
.get();

// add another index for testing closed indices etc...
client().prepareIndex("test2", MapperService.SINGLE_MAPPING_NAME).setId("7").setSource("text", "amsterdam", "population", 851573)
client().prepareIndex("test2").setId("7").setSource("text", "amsterdam", "population", 851573)
.get();
refresh();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void testConcurrentDeleteByQueriesOnDifferentDocs() throws Throwable {
List<IndexRequestBuilder> builders = new ArrayList<>();
for (int i = 0; i < docs; i++) {
for (int t = 0; t < threads.length; t++) {
builders.add(client().prepareIndex("test", "doc").setSource("field", t));
builders.add(client().prepareIndex("test").setSource("field", t));
}
}
indexRandom(true, true, true, builders);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected Settings nodeSettings() {

@Before
public void setupSourceIndex() {
client().prepareIndex("source", "test").setSource("test", "test").setRefreshPolicy(RefreshPolicy.IMMEDIATE).get();
client().prepareIndex("source").setSource("test", "test").setRefreshPolicy(RefreshPolicy.IMMEDIATE).get();
}

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private void testCase(
// Build the test data. Don't use indexRandom because that won't work consistently with such small thread pools.
BulkRequestBuilder bulk = client().prepareBulk();
for (int i = 0; i < DOC_COUNT; i++) {
bulk.add(client().prepareIndex("source", "test").setSource("foo", "bar " + i));
bulk.add(client().prepareIndex("source").setSource("foo", "bar " + i));
}

Retry retry = new Retry(BackoffPolicy.exponentialBackoff(), client().threadPool());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ public void testSimpleWorkflow() {

logger.info("--> delete some data");
for (int i = 0; i < 50; i++) {
client.prepareDelete("test-idx-1", "doc", Integer.toString(i)).get();
client.prepareDelete("test-idx-1", Integer.toString(i)).get();
}
for (int i = 50; i < 100; i++) {
client.prepareDelete("test-idx-2", "doc", Integer.toString(i)).get();
client.prepareDelete("test-idx-2", Integer.toString(i)).get();
}
for (int i = 0; i < 100; i += 2) {
client.prepareDelete("test-idx-3", "doc", Integer.toString(i)).get();
client.prepareDelete("test-idx-3", Integer.toString(i)).get();
}
client().admin().indices().prepareRefresh().get();
assertThat(count(client, "test-idx-1"), equalTo(50L));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,6 @@ public DeleteRequestBuilder(ElasticsearchClient client, DeleteAction action, @Nu
super(client, action, new DeleteRequest(index));
}

/**
* Sets the type of the document to delete.
* @deprecated types are being removed
*/
@Deprecated
public DeleteRequestBuilder setType(String type) {
return this;
}

/**
* Sets the id of the document to delete.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,10 @@ public UpdateRequestBuilder(ElasticsearchClient client, UpdateAction action) {
super(client, action, new UpdateRequest());
}

@Deprecated
public UpdateRequestBuilder(ElasticsearchClient client, UpdateAction action, String index, String type, String id) {
super(client, action, new UpdateRequest(index, id));
}

public UpdateRequestBuilder(ElasticsearchClient client, UpdateAction action, String index, String id) {
super(client, action, new UpdateRequest(index, id));
}

/**
* Sets the type of the indexed document.
* @deprecated types are being removed
*/
@Deprecated
public UpdateRequestBuilder setType(String type) {
return this;
}

/**
* Sets the id of the indexed document.
*/
Expand Down
72 changes: 35 additions & 37 deletions server/src/main/java/org/elasticsearch/client/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public interface Client extends ElasticsearchClient, Releasable {


/**
* Index a JSON source associated with a given index and type.
* Index a JSON source associated with a given index.
* <p>
* The id is optional, if it is not provided, one will be generated automatically.
*
Expand All @@ -111,7 +111,7 @@ public interface Client extends ElasticsearchClient, Releasable {
ActionFuture<IndexResponse> index(IndexRequest request);

/**
* Index a document associated with a given index and type.
* Index a document associated with a given index.
* <p>
* The id is optional, if it is not provided, one will be generated automatically.
*
Expand All @@ -122,12 +122,32 @@ public interface Client extends ElasticsearchClient, Releasable {
void index(IndexRequest request, ActionListener<IndexResponse> listener);

/**
* Index a document associated with a given index and type.
* Index a document associated with a given index.
* <p>
* The id is optional, if it is not provided, one will be generated automatically.
*/
IndexRequestBuilder prepareIndex();

/**
* Index a document associated with a given index.
* <p>
* The id is optional, if it is not provided, one will be generated automatically.
*
* @param index The index to index the document to
*/
IndexRequestBuilder prepareIndex(String index);

/**
* Index a document associated with a given index and type.
* <p>
* The id is optional, if it is not provided, one will be generated automatically.
*
* @param index The index to index the document to
* @param type The type to index the document to
* @param id The id of the document
*/
IndexRequestBuilder prepareIndex(String index, String type, @Nullable String id);

/**
* Updates a document based on a script.
*
Expand All @@ -152,31 +172,10 @@ public interface Client extends ElasticsearchClient, Releasable {
/**
* Updates a document based on a script.
*/
UpdateRequestBuilder prepareUpdate(String index, String type, String id);
UpdateRequestBuilder prepareUpdate(String index, String id);

/**
* Index a document associated with a given index and type.
* <p>
* The id is optional, if it is not provided, one will be generated automatically.
*
* @param index The index to index the document to
* @param type The type to index the document to
*/
IndexRequestBuilder prepareIndex(String index, String type);

/**
* Index a document associated with a given index and type.
* <p>
* The id is optional, if it is not provided, one will be generated automatically.
*
* @param index The index to index the document to
* @param type The type to index the document to
* @param id The id of the document
*/
IndexRequestBuilder prepareIndex(String index, String type, @Nullable String id);

/**
* Deletes a document from the index based on the index, type and id.
* Deletes a document from the index based on the index and id.
*
* @param request The delete request
* @return The result future
Expand All @@ -185,7 +184,7 @@ public interface Client extends ElasticsearchClient, Releasable {
ActionFuture<DeleteResponse> delete(DeleteRequest request);

/**
* Deletes a document from the index based on the index, type and id.
* Deletes a document from the index based on the index and id.
*
* @param request The delete request
* @param listener A listener to be notified with a result
Expand All @@ -194,18 +193,17 @@ public interface Client extends ElasticsearchClient, Releasable {
void delete(DeleteRequest request, ActionListener<DeleteResponse> listener);

/**
* Deletes a document from the index based on the index, type and id.
* Deletes a document from the index based on the index and id.
*/
DeleteRequestBuilder prepareDelete();

/**
* Deletes a document from the index based on the index, type and id.
* Deletes a document from the index based on the index and id.
*
* @param index The index to delete the document from
* @param type The type of the document to delete
* @param id The id of the document to delete
*/
DeleteRequestBuilder prepareDelete(String index, String type, String id);
DeleteRequestBuilder prepareDelete(String index, String id);

/**
* Executes a bulk of index / delete operations.
Expand Down Expand Up @@ -236,7 +234,7 @@ public interface Client extends ElasticsearchClient, Releasable {
BulkRequestBuilder prepareBulk(@Nullable String globalIndex);

/**
* Gets the document that was indexed from an index with a type and id.
* Gets the document that was indexed from an index with an id.
*
* @param request The get request
* @return The result future
Expand All @@ -245,7 +243,7 @@ public interface Client extends ElasticsearchClient, Releasable {
ActionFuture<GetResponse> get(GetRequest request);

/**
* Gets the document that was indexed from an index with a type and id.
* Gets the document that was indexed from an index with an id.
*
* @param request The get request
* @param listener A listener to be notified with a result
Expand All @@ -254,7 +252,7 @@ public interface Client extends ElasticsearchClient, Releasable {
void get(GetRequest request, ActionListener<GetResponse> listener);

/**
* Gets the document that was indexed from an index with a type and id.
* Gets the document that was indexed from an index with an id.
*/
GetRequestBuilder prepareGet();

Expand All @@ -279,7 +277,7 @@ public interface Client extends ElasticsearchClient, Releasable {
MultiGetRequestBuilder prepareMultiGet();

/**
* Search across one or more indices and one or more types with a query.
* Search across one or more indices with a query.
*
* @param request The search request
* @return The result future
Expand All @@ -288,7 +286,7 @@ public interface Client extends ElasticsearchClient, Releasable {
ActionFuture<SearchResponse> search(SearchRequest request);

/**
* Search across one or more indices and one or more types with a query.
* Search across one or more indices with a query.
*
* @param request The search request
* @param listener A listener to be notified of the result
Expand All @@ -297,7 +295,7 @@ public interface Client extends ElasticsearchClient, Releasable {
void search(SearchRequest request, ActionListener<SearchResponse> listener);

/**
* Search across one or more indices and one or more types with a query.
* Search across one or more indices with a query.
*/
SearchRequestBuilder prepareSearch(String... indices);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,8 @@ public IndexRequestBuilder prepareIndex() {
}

@Override
public IndexRequestBuilder prepareIndex(String index, String type) {
return prepareIndex(index, type, null);
public IndexRequestBuilder prepareIndex(String index) {
return prepareIndex(index, null, null);
}

@Override
Expand All @@ -421,12 +421,12 @@ public void update(final UpdateRequest request, final ActionListener<UpdateRespo

@Override
public UpdateRequestBuilder prepareUpdate() {
return new UpdateRequestBuilder(this, UpdateAction.INSTANCE, null, null, null);
return new UpdateRequestBuilder(this, UpdateAction.INSTANCE, null, null);
}

@Override
public UpdateRequestBuilder prepareUpdate(String index, String type, String id) {
return new UpdateRequestBuilder(this, UpdateAction.INSTANCE, index, type, id);
public UpdateRequestBuilder prepareUpdate(String index, String id) {
return new UpdateRequestBuilder(this, UpdateAction.INSTANCE, index, id);
}

@Override
Expand All @@ -445,8 +445,8 @@ public DeleteRequestBuilder prepareDelete() {
}

@Override
public DeleteRequestBuilder prepareDelete(String index, String type, String id) {
return prepareDelete().setIndex(index).setType(type).setId(id);
public DeleteRequestBuilder prepareDelete(String index, String id) {
return prepareDelete().setIndex(index).setId(id);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ public void waitForTaskCompletion(Task task) {
}
// Need to run the task in a separate thread because node client's .execute() is blocked by our task listener
index = new Thread(() -> {
IndexResponse indexResponse = client().prepareIndex("test", "test").setSource("test", "test").get();
IndexResponse indexResponse = client().prepareIndex("test").setSource("test", "test").get();
assertArrayEquals(ReplicationResponse.EMPTY, indexResponse.getShardInfo().getFailures());
});
index.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ protected void setUpRepository() throws Exception {

int docs = between(10, 100);
for (int i = 0; i < docs; i++) {
client().prepareIndex(INDEX_NAME, "type").setSource("test", "init").execute().actionGet();
client().prepareIndex(INDEX_NAME).setSource("test", "init").execute().actionGet();
}
docs = between(10, 100);
for (int i = 0; i < docs; i++) {
client().prepareIndex(OTHER_INDEX_NAME, "type").setSource("test", "init").execute().actionGet();
client().prepareIndex(OTHER_INDEX_NAME).setSource("test", "init").execute().actionGet();
}

logger.info("--> register a repository");
Expand Down
Loading