Skip to content

Commit

Permalink
Improve SearchApplication definition (and related)
Browse files Browse the repository at this point in the history
  • Loading branch information
flobernd committed Oct 22, 2024
1 parent 2fdec29 commit ed55594
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 48 deletions.
27 changes: 4 additions & 23 deletions specification/search_application/_types/SearchApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,17 @@
* under the License.
*/

import { IndexName, Name } from '@_types/common'
import { Script } from '@_types/Scripting'
import { Name } from '@_types/common'
import { EpochTime, UnitMillis } from '@_types/Time'
import { SearchApplicationParameters } from './SearchApplicationParameters'

export class SearchApplication {
export class SearchApplication extends SearchApplicationParameters {
/**
* Search Application name.
* Search Application name
*/
name: Name
/**
* Indices that are part of the Search Application.
*/
indices: IndexName[]
/**
* Last time the Search Application was updated.
*/
updated_at_millis: EpochTime<UnitMillis>
/**
* Analytics collection associated to the Search Application.
*/
analytics_collection_name?: Name
/**
* Search template to use on search operations.
*/
template?: SearchApplicationTemplate
}

export class SearchApplicationTemplate {
/**
* The associated mustache template.
*/
script: Script
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { IndexName, Name } from '@_types/common'
import { SearchApplicationTemplate } from './SearchApplicationTemplate'

export class SearchApplicationParameters {
/**
* Indices that are part of the Search Application.
*/
indices: IndexName[]
/**
* Analytics collection associated to the Search Application.
*/
analytics_collection_name?: Name
/**
* Search template to use on search operations.
*/
template?: SearchApplicationTemplate
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { Script } from '@_types/Scripting'

export class SearchApplicationTemplate {
/**
* The associated mustache template.
*/
script: Script
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { SearchApplication } from '../_types/SearchApplication'
import { SearchApplication } from '@search_application/_types/SearchApplication'

export class Response {
body: SearchApplication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,12 @@
* under the License.
*/

import { IndexName, Name } from '@_types/common'
import { SearchApplication } from '@search_application/_types/SearchApplication'
import { long } from '@_types/Numeric'
import { EpochTime, UnitMillis } from '@_types/Time'

export class Response {
body: {
count: long
results: SearchApplicationListItem[]
results: SearchApplication[]
}
}

export class SearchApplicationListItem {
/**
* Search Application name
*/
name: Name
/**
* Indices that are part of the Search Application
*/
indices: IndexName[]
/**
* Last time the Search Application was updated
*/
updated_at_millis: EpochTime<UnitMillis>
/**
* Analytics collection associated to the Search Application
*/
analytics_collection_name?: Name
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
import { RequestBase } from '@_types/Base'
import { Name } from '@_types/common'
import { SearchApplication } from '../_types/SearchApplication'
import { SearchApplicationParameters } from '../_types/SearchApplicationParameters'

/**
* Create or update a search application.
Expand All @@ -44,5 +44,5 @@ export interface Request extends RequestBase {
* Contains parameters for a search application.
*/
/** @codegen_name search_application */
body: SearchApplication
body: SearchApplicationParameters
}

0 comments on commit ed55594

Please sign in to comment.