Skip to content

Fix search Request #390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 87 additions & 35 deletions output/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -24174,7 +24174,7 @@
"properties": [
{
"name": "filter",
"required": true,
"required": false,
"type": {
"kind": "instance_of",
"type": {
Expand Down Expand Up @@ -49995,6 +49995,18 @@
}
}
},
{
"name": "combined_fields",
"required": false,
"since": "7.13.0",
"type": {
"kind": "instance_of",
"type": {
"name": "CombinedFieldsQuery",
"namespace": "_types.query_dsl.abstractions.query"
}
}
},
{
"name": "constant_score",
"required": false,
Expand Down Expand Up @@ -50155,31 +50167,10 @@
"name": "geo_distance",
"required": false,
"type": {
"generics": [
{
"items": [
{
"kind": "instance_of",
"type": {
"name": "GeoDistanceQuery",
"namespace": "_types.query_dsl.geo.distance"
}
},
{
"kind": "instance_of",
"type": {
"name": "string",
"namespace": "internal"
}
}
],
"kind": "union_of"
}
],
"kind": "instance_of",
"type": {
"name": "NamedQuery",
"namespace": "_types.query_dsl.abstractions.query"
"name": "GeoDistanceQuery",
"namespace": "_types.query_dsl.geo.distance"
}
}
},
Expand Down Expand Up @@ -51113,6 +51104,51 @@
}
]
},
{
"kind": "interface",
"name": {
"name": "CombinedFieldsQuery",
"namespace": "_types.query_dsl.abstractions.query"
},
"properties": [
{
"name": "query",
"required": true,
"type": {
"kind": "instance_of",
"type": {
"name": "string",
"namespace": "internal"
}
}
},
{
"name": "fields",
"required": true,
"type": {
"kind": "array_of",
"value": {
"kind": "instance_of",
"type": {
"name": "Field",
"namespace": "_types"
}
}
}
},
{
"name": "operator",
"required": false,
"type": {
"kind": "instance_of",
"type": {
"name": "string",
"namespace": "internal"
}
}
}
]
},
{
"attachedBehaviors": [
"AdditionalProperties"
Expand Down Expand Up @@ -54387,6 +54423,33 @@
}
},
{
"attachedBehaviors": [
"AdditionalProperties"
],
"behaviors": [
{
"generics": [
{
"kind": "instance_of",
"type": {
"name": "string",
"namespace": "internal"
}
},
{
"kind": "instance_of",
"type": {
"name": "GeoLocation",
"namespace": "_types.query_dsl.geo"
}
}
],
"type": {
"name": "AdditionalProperties",
"namespace": "_spec_utils"
}
}
],
"inherits": {
"type": {
"name": "QueryBase",
Expand Down Expand Up @@ -54421,17 +54484,6 @@
}
}
},
{
"name": "location",
"required": false,
"type": {
"kind": "instance_of",
"type": {
"name": "GeoLocation",
"namespace": "_types.query_dsl.geo"
}
}
},
{
"name": "validation_method",
"required": false,
Expand Down
16 changes: 12 additions & 4 deletions output/typescript/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@ export type SearchSortGeoDistanceSort = SearchSortGeoDistanceSortKeys |
{ [property: string]: QueryDslGeoGeoLocation | QueryDslGeoGeoLocation[] }

export interface SearchSortNestedSortValue {
filter: QueryDslAbstractionsContainerQueryContainer
filter?: QueryDslAbstractionsContainerQueryContainer
max_children?: integer
path: Field
}
Expand Down Expand Up @@ -4103,14 +4103,15 @@ export interface QueryDslAbstractionsContainerQueryContainer {
bool?: QueryDslCompoundBoolBoolQuery
boosting?: QueryDslCompoundBoostingBoostingQuery
common?: Record<Field, QueryDslFullTextCommonTermsCommonTermsQuery | string>
combined_fields?: QueryDslAbstractionsQueryCombinedFieldsQuery
constant_score?: QueryDslCompoundConstantScoreConstantScoreQuery
dis_max?: QueryDslCompoundDismaxDisMaxQuery
distance_feature?: Record<Field, QueryDslSpecializedDistanceFeatureDistanceFeatureQuery | string> | QueryDslSpecializedDistanceFeatureDistanceFeatureQuery
exists?: QueryDslTermLevelExistsExistsQuery
function_score?: QueryDslCompoundFunctionScoreFunctionScoreQuery
fuzzy?: Record<Field, QueryDslTermLevelFuzzyFuzzyQuery | string>
geo_bounding_box?: QueryDslAbstractionsQueryNamedQuery<QueryDslGeoBoundingBoxGeoBoundingBoxQuery | string>
geo_distance?: QueryDslAbstractionsQueryNamedQuery<QueryDslGeoDistanceGeoDistanceQuery | string>
geo_distance?: QueryDslGeoDistanceGeoDistanceQuery
geo_polygon?: QueryDslAbstractionsQueryNamedQuery<QueryDslGeoPolygonGeoPolygonQuery | string>
geo_shape?: QueryDslAbstractionsQueryNamedQuery<QueryDslGeoShapeGeoShapeQuery | string>
has_child?: QueryDslJoiningHasChildHasChildQuery
Expand Down Expand Up @@ -4166,6 +4167,12 @@ export interface QueryDslAbstractionsFieldLookupFieldLookup {
routing?: Routing
}

export interface QueryDslAbstractionsQueryCombinedFieldsQuery {
query: string
fields: Field[]
operator?: string
}

export interface QueryDslAbstractionsQueryNamedQueryKeys<TQuery = unknown> {
boost?: float
_name?: string
Expand Down Expand Up @@ -4509,12 +4516,13 @@ export interface QueryDslGeoBoundingBoxGeoBoundingBoxQuery extends QueryDslAbstr

export type QueryDslGeoBoundingBoxGeoExecution = 'memory' | 'indexed'

export interface QueryDslGeoDistanceGeoDistanceQuery extends QueryDslAbstractionsQueryQueryBase {
export interface QueryDslGeoDistanceGeoDistanceQueryKeys extends QueryDslAbstractionsQueryQueryBase {
distance?: Distance
distance_type?: GeoDistanceType
location?: QueryDslGeoGeoLocation
validation_method?: QueryDslGeoGeoValidationMethod
}
export type QueryDslGeoDistanceGeoDistanceQuery = QueryDslGeoDistanceGeoDistanceQueryKeys |
{ [property: string]: QueryDslGeoGeoLocation }

export interface QueryDslGeoPolygonGeoPolygonQuery extends QueryDslAbstractionsQueryQueryBase {
points?: QueryDslGeoGeoLocation[]
Expand Down
1 change: 0 additions & 1 deletion specification/_global/search/SearchRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export interface Request extends RequestBase {
from?: integer
highlight?: Highlight
track_total_hits?: boolean | integer
/** @prop_serializer IndicesBoostFormatter */
indices_boost?: Array<Dictionary<IndexName, double>>
docvalue_fields?: DocValueField | Array<Field | DocValueField>
min_score?: double
Expand Down
4 changes: 2 additions & 2 deletions specification/_global/search/sort/NestedSort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import { integer } from '@_types/Numeric'
import { QueryContainer } from '@_types/query_dsl/abstractions/container/QueryContainer'

export class NestedSortValue {
filter: QueryContainer
filter?: QueryContainer
max_children?: integer
path: Field
//nested: NestedSortValue
// nested: NestedSortValue
}

// export type NestedSort = Dictionary<Field, NestedSortKey>
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import { TermsQuery } from '@_types/query_dsl/term_level/terms/TermsQuery'
import { TermsSetQuery } from '@_types/query_dsl/term_level/terms_set/TermsSetQuery'
import { TypeQuery } from '@_types/query_dsl/term_level/type/TypeQuery'
import { WildcardQuery } from '@_types/query_dsl/term_level/wildcard/WildcardQuery'
import { NamedQuery } from '../query/Query'
import { CombinedFieldsQuery, NamedQuery } from '../query/Query'
import { QueryTemplate } from './QueryTemplate'
import { Field } from '@_types/common'

Expand All @@ -82,6 +82,8 @@ export class QueryContainer {
bool?: BoolQuery
boosting?: BoostingQuery
common?: SingleKeyDictionary<Field, CommonTermsQuery | string>
/** @since 7.13.0 */
combined_fields?: CombinedFieldsQuery
constant_score?: ConstantScoreQuery
dis_max?: DisMaxQuery
// TODO?: can be both { __field__ ?: { options } } and { field?: "" ...options }
Expand All @@ -93,7 +95,7 @@ export class QueryContainer {
function_score?: FunctionScoreQuery
fuzzy?: SingleKeyDictionary<Field, FuzzyQuery | string>
geo_bounding_box?: NamedQuery<GeoBoundingBoxQuery | string>
geo_distance?: NamedQuery<GeoDistanceQuery | string>
geo_distance?: GeoDistanceQuery
geo_polygon?: NamedQuery<GeoPolygonQuery | string>
geo_shape?: NamedQuery<GeoShapeQuery | string>
has_child?: HasChildQuery
Expand Down
7 changes: 7 additions & 0 deletions specification/_types/query_dsl/abstractions/query/Query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import { AdditionalProperties } from '@spec_utils/behaviors'
import { Field } from '@_types/common'
import { float } from '@_types/Numeric'

export class QueryBase {
Expand All @@ -38,3 +39,9 @@ export class NamedQuery<TQuery>
_name?: string
ignore_unmapped?: boolean
}

export class CombinedFieldsQuery {
query: string
fields: Field[]
operator?: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@
* under the License.
*/

import { AdditionalProperties } from '@spec_utils/behaviors'
import { Distance, GeoDistanceType } from '@_types/Geo'
import { QueryBase } from '@_types/query_dsl/abstractions/query/Query'
import { GeoLocation } from '../GeoLocation'
import { GeoValidationMethod } from '../GeoValidationMethod'

export class GeoDistanceQuery extends QueryBase {
export class GeoDistanceQuery
extends QueryBase
implements AdditionalProperties<string, GeoLocation> {
distance?: Distance
distance_type?: GeoDistanceType
location?: GeoLocation
validation_method?: GeoValidationMethod
}