Skip to content

Commit 2d0a0fd

Browse files
authored
Improve SearchApplication definition (and related) (#3040)
1 parent 6cbace5 commit 2d0a0fd

File tree

6 files changed

+72
-48
lines changed

6 files changed

+72
-48
lines changed

specification/search_application/_types/SearchApplication.ts

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,17 @@
1717
* under the License.
1818
*/
1919

20-
import { IndexName, Name } from '@_types/common'
21-
import { Script } from '@_types/Scripting'
20+
import { Name } from '@_types/common'
2221
import { EpochTime, UnitMillis } from '@_types/Time'
22+
import { SearchApplicationParameters } from './SearchApplicationParameters'
2323

24-
export class SearchApplication {
24+
export class SearchApplication extends SearchApplicationParameters {
2525
/**
26-
* Search Application name.
26+
* Search Application name
2727
*/
2828
name: Name
29-
/**
30-
* Indices that are part of the Search Application.
31-
*/
32-
indices: IndexName[]
3329
/**
3430
* Last time the Search Application was updated.
3531
*/
3632
updated_at_millis: EpochTime<UnitMillis>
37-
/**
38-
* Analytics collection associated to the Search Application.
39-
*/
40-
analytics_collection_name?: Name
41-
/**
42-
* Search template to use on search operations.
43-
*/
44-
template?: SearchApplicationTemplate
45-
}
46-
47-
export class SearchApplicationTemplate {
48-
/**
49-
* The associated mustache template.
50-
*/
51-
script: Script
5233
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { IndexName, Name } from '@_types/common'
21+
import { SearchApplicationTemplate } from './SearchApplicationTemplate'
22+
23+
export class SearchApplicationParameters {
24+
/**
25+
* Indices that are part of the Search Application.
26+
*/
27+
indices: IndexName[]
28+
/**
29+
* Analytics collection associated to the Search Application.
30+
*/
31+
analytics_collection_name?: Name
32+
/**
33+
* Search template to use on search operations.
34+
*/
35+
template?: SearchApplicationTemplate
36+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { Script } from '@_types/Scripting'
21+
22+
export class SearchApplicationTemplate {
23+
/**
24+
* The associated mustache template.
25+
*/
26+
script: Script
27+
}

specification/search_application/get/SearchApplicationsGetResponse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* under the License.
1818
*/
1919

20-
import { SearchApplication } from '../_types/SearchApplication'
20+
import { SearchApplication } from '@search_application/_types/SearchApplication'
2121

2222
export class Response {
2323
body: SearchApplication

specification/search_application/list/SearchApplicationsListResponse.ts

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,12 @@
1717
* under the License.
1818
*/
1919

20-
import { IndexName, Name } from '@_types/common'
20+
import { SearchApplication } from '@search_application/_types/SearchApplication'
2121
import { long } from '@_types/Numeric'
22-
import { EpochTime, UnitMillis } from '@_types/Time'
2322

2423
export class Response {
2524
body: {
2625
count: long
27-
results: SearchApplicationListItem[]
26+
results: SearchApplication[]
2827
}
2928
}
30-
31-
export class SearchApplicationListItem {
32-
/**
33-
* Search Application name
34-
*/
35-
name: Name
36-
/**
37-
* Indices that are part of the Search Application
38-
*/
39-
indices: IndexName[]
40-
/**
41-
* Last time the Search Application was updated
42-
*/
43-
updated_at_millis: EpochTime<UnitMillis>
44-
/**
45-
* Analytics collection associated to the Search Application
46-
*/
47-
analytics_collection_name?: Name
48-
}

specification/search_application/put/SearchApplicationsPutRequest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
import { RequestBase } from '@_types/Base'
2020
import { Name } from '@_types/common'
21-
import { SearchApplication } from '../_types/SearchApplication'
21+
import { SearchApplicationParameters } from '../_types/SearchApplicationParameters'
2222

2323
/**
2424
* Create or update a search application.
@@ -44,5 +44,5 @@ export interface Request extends RequestBase {
4444
* Contains parameters for a search application.
4545
*/
4646
/** @codegen_name search_application */
47-
body: SearchApplication
47+
body: SearchApplicationParameters
4848
}

0 commit comments

Comments
 (0)