I’m looking into integrating elasticsearch into my spring-jpa driven application.
For this purpose the elasticsearch-osem project seems an amazing fit.
What I can’t understand is what is the role of the @Indexable(indexName = "someIndex") annotation which is shown in the example from the introduction to the project.
What confuses me is the fact that in the same example it says:
Then you can write objects to the ElasticSearch client:
node.client().prepareIndex(“twitter”, “tweet”,”1″).setSource(context.write(tweet)).execute().actionGet();
Where “twitter” is the index-name.
I think my question is why should one also define an @Indexable on a field and why should they define an index-name?
Thanks
After looking through the source code I was able to see that the @Indexable is used to either supply aliases to the fields of indexed properties in indexed entities or to allow indexing of properties in un-indexed entities.
You can see this in the
getIndexablePropertiesmethod in theAttributeSourceImpltype where it says in a comment: