-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Map index name to document #2112
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
Comments
Not clear what mean with
How are these index names constructed? Can't you search with a wildcard or index aliases? |
The processor points the document to an index with the structure yyyy-MM-dd, the date is determined by the value inside a field given as a parameter to the processor. |
even if it would be possible to write the index name to the document during writing, you would not have it back in the application. And even if so - if storing an entity in index-a and returning the information as result of the save or storing it in the entity on save would work - how would you later have this information to get the entity? That would mean to store the combination of entity id and index somewhere else. And how would an |
I have an ingestion pipeline associated to an index, when we put a document into that index instead of being written on that specific index it gets routed to another index based on the date value contained in the said document. I've successfully done that using the RestHighLevelClient and the actual index where the document has been written is included in the response.
Yes, and that's where an Model model = new Model();
Map<String, Object> map = objectMapper.convertValue(model, new TypeReference<>() {});
IndexRequest request = new IndexRequest("my-index");
request.source(map);
IndexResponse response = restHighLevelClient.index(request, RequestOptions.DEFAULT);
String index = response.getIndex();
String id = response.getId();
By introducing an Model model = new Model();
Model saved = elasticsearchOperations.save(model, IndexCoordinates.of("my-index")); After that I expect that calling |
ok, I got it. Although I am not sure if |
Yes, I agree with you. Maybe |
|
We're using a date index name processor to point a document to the right index based on a document's date field value.
After saving the document we need to get it again from Elasticsearch to read some fields that are filled by an ingestion pipeline.
The issue is that after the save we don't know the index name where the document has been saved.
Could it be possible to add a
@Index
annotation that maps the document's index name on the Java field?The text was updated successfully, but these errors were encountered: