Skip to content

Conversation

@gdaniel
Copy link
Contributor

@gdaniel gdaniel commented Jan 12, 2026

Bug: #1694

PLEASE READ ALL ITEMS AND CHECK ONLY RELEVANT CHECKBOXES BELOW

Auto review

  • Have you reviewed this PR? Please do a first quick review, It is very useful to detect typos and missing copyrights, check comments, check your code... The reviewer will thank you for that :)

Project management

  • Has the pull request been added to the relevant milestone?
  • Have the priority: and pr: labels been added to the pull request? (In case of doubt, start with the labels priority: low and pr: to review later)
  • Have the relevant issues been added to the pull request?
  • Have the relevant labels been added to the issues? (area:, type:)
  • Have the relevant issues been added to the same project milestone as the pull request?

Changelog and release notes

  • Has the CHANGELOG.adoc + doc/content/modules/user-manual/pages/release-notes/YYYY.MM.0.adoc been updated to reference the relevant issues?
  • Have the relevant API breaks been described in the CHANGELOG.adoc?
  • Are the new / upgraded dependencies mentioned in the relevant section of the CHANGELOG.adoc?
  • In case of a change with a visual impact, are there any screenshots in the doc/content/modules/user-manual/pages/release-notes/YYYY.MM.0.adoc?
  • In case of a key change, has the change been added to Key highlights section in doc/content/modules/user-manual/pages/release-notes/YYYY.MM.0.adoc?

Documentation

  • Have you included an update of the documentation in your pull request? Please ask yourself if an update (installation manual, user manual, developer manual...) is needed and add one accordingly.

Tests

  • Is the code properly tested? Any pull request (fix, enhancement or new feature) should come with a test (or several). It could be unit tests, integration tests or cypress tests depending on the context. Only doc and releng pull request do not need for tests.

@AxelRICHARD AxelRICHARD added this to the 2026.1.0 milestone Jan 13, 2026
@AxelRICHARD AxelRICHARD linked an issue Jan 13, 2026 that may be closed by this pull request
@gdaniel gdaniel force-pushed the gda/enh/elasticsearch_integration branch from c9041b5 to 968d591 Compare January 13, 2026 09:33
- https://github.com/eclipse-syson/syson/issues/1694[#1694] [syson] Customize Elasticsearch indices to work with SysML.
SysON now uses its own indexing logic instead of the default one provided by Sirius Web.
This allows to limit the size of the indices, and ensure information stored in the indices are useful to perform cross-project search.
You can find more information on how to setup Elasticsearch, how elements are mapped to index documents, and how to query them in the documentation.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't add a link to the documentation because the page doesn't exist yet (it is added by this PR)

@Override
public boolean canHandle(IEditingContext editingContext, Object object) {
// Only produce SysON index entries for non-studio projects.
return !this.studioCapableEditingContextPredicate.test(editingContext.getId());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the same condition here as we did in #944 to discriminate SysON projects from Studio projects.

}

private void clearIndex(IEditingContext editingContext) {
this.indexDeletionService.deleteIndex(editingContext.getId());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some cases (particularly when a new project is created), this line may throw an exception indicating that the index does not exist. This exception doesn't crash the application, it just prevents an update of the index, which is not critical (it will be updated later when the semantic data gets updated).
This issue is linked to eclipse-sirius/sirius-web#6044, and should be fixed in Sirius Web, not SysON.

Comment on lines +50 to +52
registry.add("spring.elasticsearch.uris", ELASTICSEARCH_CONTAINER::getHttpHostAddress);
registry.add("spring.elasticsearch.username", () -> "elastic");
registry.add("spring.elasticsearch.password", () -> ElasticsearchContainer.ELASTICSEARCH_DEFAULT_PASSWORD);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the same approach we use in Sirius Web: Elasticsearch is enabled for all the tests, it should be possible to check the indices anytime, even in existing test cases.
If this slows significantly the build we can think of an alternative solution.

@gdaniel
Copy link
Contributor Author

gdaniel commented Jan 13, 2026

Note that this PR doesn't add Elasticsearch in the docker compose file, I don't have the expertise to do this, but it is currently a work in progress in a downstream project.
Once we know how to integrate it in our docker environment, it will be possible to deploy it on staging (if we want to), and more importantly define cypress/playwright tests to check the entire feature.

@gdaniel gdaniel marked this pull request as ready for review January 13, 2026 09:45
Bug: #1694
Signed-off-by: Gwendal Daniel <gwendal.daniel@obeosoft.com>

# Conflicts:
#	CHANGELOG.adoc
#	doc/content/modules/user-manual/pages/release-notes/2026.1.0.adoc
@gdaniel gdaniel force-pushed the gda/enh/elasticsearch_integration branch from 968d591 to 234eb4d Compare January 13, 2026 14:37
ownedSpecializationNestedIndexEntries, ownedElementNestedIndexEntries));
}

@Override
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put this method in the beginning of the class

}

@Override
public Optional<IIndexEntry> doSwitch(EObject eObject) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put this method in the beginning of the class

@JsonProperty(IIndexEntry.LABEL_FIELD)
String label();


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless empty line

*
* @author gdaniel
*/
public record NamespaceIndexEntry(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add javadoc for each parameter of the record?

*
* @author gdaniel
*/
public record NestedElementIndexEntry(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add javadoc for each parameter of the record?

}

@Override
public Optional<INestedIndexEntry> doSwitch(EObject eObject) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put this method in the beginning of the class

*
* @author gdaniel
*/
public record NestedSpecializationIndexEntry(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add javadoc for each parameter of the record? And add some details about the role of this record

*
* @author gdaniel
*/
public record TypeIndexEntry(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add javadoc for each parameter of the record? And add some details about the purpose of this record.

import co.elastic.clients.util.NamedValue;

/**
* Creates indices to store SysML models.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add some detail about the purpose of this class?

* @author gdaniel
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@nestedIndexEntryType")
public interface INestedIndexEntry {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add some detail about the purpose of this interface?

@AxelRICHARD
Copy link
Member

First review, I need to do a second one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Customize Elasticsearch indices to work with SysML

3 participants