17
17
18
18
import com .fasterxml .jackson .databind .ObjectMapper ;
19
19
import io .hops .hopsworks .common .commands .CommandException ;
20
+ import io .hops .hopsworks .common .featurestore .FeaturestoreController ;
20
21
import io .hops .hopsworks .common .featurestore .featuregroup .FeaturegroupController ;
21
22
import io .hops .hopsworks .common .featurestore .metadata .FeatureStoreKeywordControllerIface ;
22
23
import io .hops .hopsworks .common .featurestore .metadata .FeatureStoreTagControllerIface ;
40
41
import io .hops .hopsworks .exceptions .OpenSearchException ;
41
42
import io .hops .hopsworks .exceptions .ServiceException ;
42
43
import io .hops .hopsworks .persistence .entity .commands .search .SearchFSCommand ;
44
+ import io .hops .hopsworks .persistence .entity .featurestore .Featurestore ;
43
45
import io .hops .hopsworks .persistence .entity .featurestore .featureview .FeatureView ;
44
46
import io .hops .hopsworks .persistence .entity .featurestore .metadata .FeatureStoreTag ;
45
47
import io .hops .hopsworks .persistence .entity .featurestore .trainingdataset .TrainingDatasetFeature ;
48
+ import io .hops .hopsworks .persistence .entity .project .Project ;
46
49
import io .hops .hopsworks .restutils .RESTCodes ;
47
50
import org .opensearch .action .delete .DeleteRequest ;
48
51
import org .opensearch .action .index .IndexRequest ;
@@ -79,6 +82,8 @@ public class SearchFSOpenSearchController {
79
82
@ EJB
80
83
private FeaturegroupController featureGroupCtrl ;
81
84
@ EJB
85
+ private FeaturestoreController featurestoreController ;
86
+ @ EJB
82
87
private TrainingDatasetController trainingDatasetCtrl ;
83
88
@ EJB
84
89
private InodeController inodeCtrl ;
@@ -158,6 +163,8 @@ private SearchDoc create(SearchFSCommand c) throws CommandException {
158
163
String featureStorePath = Utils .getFeaturestorePath (c .getProject (), settings );
159
164
Long featureStoreInode = inodeCtrl .getInodeAtPath (featureStorePath ).getId ();
160
165
doc .setDatasetIId (featureStoreInode );
166
+ Featurestore featurestore = getFeatureStoreForProject (c .getProject ());
167
+ doc .setFeaturestoreId (featurestore .getId ());
161
168
if (c .getFeatureGroup () != null ) {
162
169
doc .setDocType (OpenSearchDocType .FEATURE_GROUP );
163
170
doc .setName (c .getFeatureGroup ().getName ());
@@ -176,6 +183,15 @@ private SearchDoc create(SearchFSCommand c) throws CommandException {
176
183
return doc ;
177
184
}
178
185
186
+ private Featurestore getFeatureStoreForProject (Project project ) throws CommandException {
187
+ try {
188
+ return featurestoreController .getProjectFeaturestore (project );
189
+ } catch (FeaturestoreException e ) {
190
+ throw new CommandException (RESTCodes .CommandErrorCode .INTERNAL_SERVER_ERROR , Level .FINE ,
191
+ e .getUsrMsg (), e .getDevMsg ());
192
+ }
193
+ }
194
+
179
195
private SearchDoc updateTags (SearchFSCommand c ) throws CommandException {
180
196
SearchDoc doc = new SearchDoc ();
181
197
Map <String , FeatureStoreTag > tags ;
0 commit comments