-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add function to list all indexes #1693
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3fbc0c7
This commit is intentend to implement the request of #1646.
gpopides 3337cd8
Made requested changes in PR #1693
gpopides 84f76dd
More changes for the code change request. Added new ResponsesConvert…
gpopides 5967c77
refactored a bit the code and added check of mappings in tests
gpopides b4d7bd1
Changed AliasMetadata to AliasData type for aliases in indexinformation,
gpopides File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -29,6 +29,8 @@ | |
import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder; | ||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; | ||
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest; | ||
import org.elasticsearch.action.admin.indices.get.GetIndexRequest; | ||
import org.elasticsearch.action.admin.indices.get.GetIndexResponse; | ||
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest; | ||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder; | ||
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest; | ||
|
@@ -57,6 +59,7 @@ | |
import org.springframework.data.elasticsearch.core.index.PutTemplateRequest; | ||
import org.springframework.data.elasticsearch.core.index.TemplateData; | ||
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates; | ||
import org.springframework.data.elasticsearch.core.mapping.IndexInformation; | ||
import org.springframework.data.elasticsearch.core.query.AliasQuery; | ||
import org.springframework.lang.Nullable; | ||
import org.springframework.util.Assert; | ||
|
@@ -66,6 +69,7 @@ | |
* | ||
* @author Peter-Josef Meisch | ||
* @author Sascha Woo | ||
* @author George Popides | ||
* @since 4.0 | ||
*/ | ||
class DefaultTransportIndexOperations extends AbstractDefaultIndexOperations implements IndexOperations { | ||
|
@@ -296,4 +300,16 @@ public boolean deleteTemplate(DeleteTemplateRequest deleteTemplateRequest) { | |
deleteTemplateRequest); | ||
return client.admin().indices().deleteTemplate(deleteIndexTemplateRequest).actionGet().isAcknowledged(); | ||
} | ||
|
||
@Override | ||
public List<IndexInformation> getInformation() { | ||
GetIndexRequest getIndexRequest = new GetIndexRequest(); | ||
IndexCoordinates index = getIndexCoordinates(); | ||
|
||
getIndexRequest.indices(index.getIndexNames()); | ||
|
||
GetIndexResponse getIndexResponse = client.admin().indices().getIndex(getIndexRequest).actionGet(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here the mapping should be done from Elasticsearch types to our data |
||
return responseConverter.indexInformationCollection(getIndexResponse); | ||
} | ||
} |
This file contains hidden or 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 |
---|---|---|
|
@@ -29,6 +29,7 @@ | |
import org.springframework.data.elasticsearch.core.index.PutTemplateRequest; | ||
import org.springframework.data.elasticsearch.core.index.TemplateData; | ||
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates; | ||
import org.springframework.data.elasticsearch.core.mapping.IndexInformation; | ||
import org.springframework.data.elasticsearch.core.query.AliasQuery; | ||
import org.springframework.lang.Nullable; | ||
|
||
|
@@ -41,6 +42,7 @@ | |
* | ||
* @author Peter-Josef Meisch | ||
* @author Sascha Woo | ||
* @author George Popides | ||
* @since 4.0 | ||
*/ | ||
public interface IndexOperations { | ||
|
@@ -317,5 +319,13 @@ default boolean deleteTemplate(String templateName) { | |
*/ | ||
IndexCoordinates getIndexCoordinates(); | ||
|
||
|
||
/** | ||
* | ||
* @return a list of {@link IndexInformation} | ||
* @since 4.2 | ||
*/ | ||
List<IndexInformation> getInformation(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add Javadoc with a |
||
|
||
// endregion | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here the mapping should be done from Elasticsearch types to our data