-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Always times out when accessing alias index #1453
Comments
Hi @al-niessner, var credentials = AwsSessionCredentials.builder()
.accessKeyId("...")
.secretAccessKey("...")
.sessionToken("...")
.build();
var transportOptions = AwsSdk2TransportOptions.builder().setCredentials(() -> credentials).build();
var transport = new AwsSdk2Transport(ApacheHttpClient.create(), ".....ap-southeast-2.aoss.amazonaws.com", "aoss", Region.AP_SOUTHEAST_2, transportOptions);
var client = new OpenSearchClient(transport);
final var indexName = "repro-index";
final var aliasName = "repro-alias";
LOGGER.info("Bulk indexing documents");
ArrayList<BulkOperation> ops = new ArrayList<>();
IndexData doc1 = new IndexData("Document 1", "The text of document 1");
ops.add(new BulkOperation.Builder().index(IndexOperation.of(io -> io.index(indexName).id("id1").document(doc1))).build());
IndexData doc2 = new IndexData("Document 2", "The text of document 2");
ops.add(new BulkOperation.Builder().index(IndexOperation.of(io -> io.index(indexName).id("id2").document(doc2))).build());
IndexData doc3 = new IndexData("Document 3", "The text of document 3");
ops.add(new BulkOperation.Builder().index(IndexOperation.of(io -> io.index(indexName).id("id3").document(doc3))).build());
BulkRequest.Builder bulkReq = new BulkRequest.Builder().index(indexName).operations(ops);
BulkResponse bulkResponse = client.bulk(bulkReq.build());
LOGGER.info("Bulk response items: {}", bulkResponse.items().size());
client.indices().updateAliases(u -> u.actions(a -> a.add(aa -> aa.index(indexName).alias(aliasName))));
Thread.sleep(10000);
var search = client.search(s -> s.index(indexName).query(q -> q.term(t -> t.field("text").value(v -> v.stringValue("document")))), IndexData.class);
LOGGER.info("Search response: {}", search.hits().hits().size());
search = client.search(s -> s.index(aliasName).query(q -> q.term(t -> t.field("text").value(v -> v.stringValue("document")))), IndexData.class);
LOGGER.info("Search response: {}", search.hits().hits().size()); |
Working... It will take me some time but will come back with a test or ah-ha as my mistake. |
Sorry for the long delay. I misrepresented the search a bit. Here is my actual search:
The virtual database (alias index) points at many real databases. Each of these can contain millions of items. The search is looking for any entries that have the same filename because they are supposed to be unique. Works on a real index but not a virtual. Still working at making a smaller test set. |
Aggregates take a long time over the very large databases. Fixed it with socketTimeout() on http client. Thanks. |
What is the bug?
I have two indices at AOSS: foo and bar. foo is a real index where data is stored and searched. bar is an alias index, which has no real data in it, that transfers all requests to foo and returns the results from foo as well. I know this works as I can use and exercise the alias with any set of queries using python. The Java SDK fails with a timeout (see below).
How can one reproduce the bug?
Create one real and one alias index at AOSS then try to query the two indices with the same search query using Java SDK2. Any search query will do. Mine are a field x equals value y.
What is the expected behavior?
I expect the alias index to behave identical to the real index as it does in python.
What is your host/environment?
Java 17, Linux.
Do you have any screenshots?
No, but here is the stack dump from the failing alias index query but the same query works with the real index:
Do you have any additional context?
When I say the same query, I literally mean the same but the name for index(name) is different. Not two different blocks of code. Just change the name variable value for the two tests.
I hope this ground has been covered already with a simple solution but neither google nor searching this bug list yielded anything helpful to me - does not mean the information is not there but that I was not able to find it quickly.
The text was updated successfully, but these errors were encountered: