Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…110028_fix
  • Loading branch information
astefan committed Jun 21, 2024
2 parents 29ef167 + 13478b2 commit 7a8a84e
Show file tree
Hide file tree
Showing 128 changed files with 3,751 additions and 968 deletions.
6 changes: 6 additions & 0 deletions docs/changelog/108764.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 108764
summary: ST_DISTANCE Function
area: ES|QL
type: enhancement
issues:
- 108212
5 changes: 5 additions & 0 deletions docs/changelog/109967.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 109967
summary: Default the HF service to cosine similarity
area: Machine Learning
type: enhancement
issues: []
5 changes: 5 additions & 0 deletions docs/changelog/110035.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 110035
summary: Fix equals and hashcode for `SingleValueQuery.LuceneQuery`
area: ES|QL
type: bug
issues: []

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions docs/reference/esql/functions/examples/st_distance.asciidoc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions docs/reference/esql/functions/kibana/definition/st_distance.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions docs/reference/esql/functions/kibana/docs/st_distance.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions docs/reference/esql/functions/layout/st_distance.asciidoc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions docs/reference/esql/functions/parameters/st_distance.asciidoc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/reference/esql/functions/signature/st_distance.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/reference/esql/functions/spatial-functions.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* experimental:[] <<esql-st_within>>
* experimental:[] <<esql-st_x>>
* experimental:[] <<esql-st_y>>
* experimental:[] <<esql-st_distance>>
// end::spatial_list[]

include::layout/st_intersects.asciidoc[]
Expand All @@ -22,3 +23,4 @@ include::layout/st_contains.asciidoc[]
include::layout/st_within.asciidoc[]
include::layout/st_x.asciidoc[]
include::layout/st_y.asciidoc[]
include::layout/st_distance.asciidoc[]
10 changes: 10 additions & 0 deletions docs/reference/esql/functions/types/st_distance.asciidoc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions docs/reference/inference/put-inference.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ It can be the ID of either a built-in model (for example, `.multilingual-e5-smal
`num_allocations`:::
(Required, integer)
The number of model allocations to create. `num_allocations` must not exceed the number of available processors per node divided by the `num_threads`.
The total number of allocations this model is assigned across machine learning nodes. Increasing this value generally increases the throughput.
`num_threads`:::
(Required, integer)
The number of threads to use by each model allocation. `num_threads` must not exceed the number of available processors per node divided by the number of allocations.
Sets the number of threads used by each model allocation during inference. This generally increases the speed per inference request. The inference process is a compute-bound process; `threads_per_allocations` must not exceed the number of available allocated processors per node.
Must be a power of 2. Max allowed value is 32.
=====
Expand All @@ -272,11 +272,11 @@ Must be a power of 2. Max allowed value is 32.
`num_allocations`:::
(Required, integer)
The number of model allocations to create. `num_allocations` must not exceed the number of available processors per node divided by the `num_threads`.
The total number of allocations this model is assigned across machine learning nodes. Increasing this value generally increases the throughput.
`num_threads`:::
(Required, integer)
The number of threads to use by each model allocation. `num_threads` must not exceed the number of available processors per node divided by the number of allocations.
Sets the number of threads used by each model allocation during inference. This generally increases the speed per inference request. The inference process is a compute-bound process; `threads_per_allocations` must not exceed the number of available allocated processors per node.
Must be a power of 2. Max allowed value is 32.
=====
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ private static void setupPrefixTrees(GeoShapeFieldType ft) {

private GeoShapeFieldType buildFieldType(LegacyGeoShapeParser parser, MapperBuilderContext context) {
GeoShapeFieldType ft = new GeoShapeFieldType(
context.buildFullName(name()),
context.buildFullName(leafName()),
indexed.get(),
orientation.get().value(),
parser,
Expand Down Expand Up @@ -352,7 +352,7 @@ private static int getLevels(int treeLevels, double precisionInMeters, int defau
public LegacyGeoShapeFieldMapper build(MapperBuilderContext context) {
LegacyGeoShapeParser parser = new LegacyGeoShapeParser();
GeoShapeFieldType ft = buildFieldType(parser, context);
return new LegacyGeoShapeFieldMapper(name(), ft, multiFieldsBuilder.build(this, context), copyTo, parser, this);
return new LegacyGeoShapeFieldMapper(leafName(), ft, multiFieldsBuilder.build(this, context), copyTo, parser, this);
}
}

Expand Down Expand Up @@ -610,7 +610,7 @@ protected String contentType() {
@Override
public FieldMapper.Builder getMergeBuilder() {
return new Builder(
simpleName(),
leafName(),
indexCreatedVersion,
builder.ignoreMalformed.getDefaultValue().value(),
builder.coerce.getDefaultValue().value()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private MatchOnlyTextFieldType buildFieldType(MapperBuilderContext context) {
NamedAnalyzer indexAnalyzer = analyzers.getIndexAnalyzer();
TextSearchInfo tsi = new TextSearchInfo(Defaults.FIELD_TYPE, null, searchAnalyzer, searchQuoteAnalyzer);
MatchOnlyTextFieldType ft = new MatchOnlyTextFieldType(
context.buildFullName(name()),
context.buildFullName(leafName()),
tsi,
indexAnalyzer,
context.isSourceSynthetic(),
Expand All @@ -140,7 +140,15 @@ private MatchOnlyTextFieldType buildFieldType(MapperBuilderContext context) {
public MatchOnlyTextFieldMapper build(MapperBuilderContext context) {
MatchOnlyTextFieldType tft = buildFieldType(context);
MultiFields multiFields = multiFieldsBuilder.build(this, context);
return new MatchOnlyTextFieldMapper(name(), Defaults.FIELD_TYPE, tft, multiFields, copyTo, context.isSourceSynthetic(), this);
return new MatchOnlyTextFieldMapper(
leafName(),
Defaults.FIELD_TYPE,
tft,
multiFields,
copyTo,
context.isSourceSynthetic(),
this
);
}
}

Expand Down Expand Up @@ -397,7 +405,7 @@ public Map<String, NamedAnalyzer> indexAnalyzers() {

@Override
public FieldMapper.Builder getMergeBuilder() {
return new Builder(simpleName(), indexCreatedVersion, indexAnalyzers).init(this);
return new Builder(leafName(), indexCreatedVersion, indexAnalyzers).init(this);
}

@Override
Expand Down Expand Up @@ -439,7 +447,7 @@ public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
"field [" + name() + "] of type [" + typeName() + "] doesn't support synthetic source because it declares copy_to"
);
}
return new StringStoredFieldFieldLoader(fieldType().storedFieldNameForSyntheticSource(), simpleName(), null) {
return new StringStoredFieldFieldLoader(fieldType().storedFieldNameForSyntheticSource(), leafName(), null) {
@Override
protected void write(XContentBuilder b, Object value) throws IOException {
b.value((String) value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ protected Parameter<?>[] getParameters() {
@Override
public RankFeatureFieldMapper build(MapperBuilderContext context) {
return new RankFeatureFieldMapper(
name(),
leafName(),
new RankFeatureFieldType(
context.buildFullName(name()),
context.buildFullName(leafName()),
meta.getValue(),
positiveScoreImpact.getValue(),
nullValue.getValue()
Expand Down Expand Up @@ -233,6 +233,6 @@ protected String contentType() {

@Override
public FieldMapper.Builder getMergeBuilder() {
return new Builder(simpleName()).init(this);
return new Builder(leafName()).init(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ protected Parameter<?>[] getParameters() {
@Override
public RankFeaturesFieldMapper build(MapperBuilderContext context) {
return new RankFeaturesFieldMapper(
name(),
new RankFeaturesFieldType(context.buildFullName(name()), meta.getValue(), positiveScoreImpact.getValue()),
leafName(),
new RankFeaturesFieldType(context.buildFullName(leafName()), meta.getValue(), positiveScoreImpact.getValue()),
multiFieldsBuilder.build(this, context),
copyTo,
positiveScoreImpact.getValue()
Expand Down Expand Up @@ -137,7 +137,7 @@ public Map<String, NamedAnalyzer> indexAnalyzers() {

@Override
public FieldMapper.Builder getMergeBuilder() {
return new Builder(simpleName()).init(this);
return new Builder(leafName()).init(this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ protected Parameter<?>[] getParameters() {
@Override
public ScaledFloatFieldMapper build(MapperBuilderContext context) {
ScaledFloatFieldType type = new ScaledFloatFieldType(
context.buildFullName(name()),
context.buildFullName(leafName()),
indexed.getValue(),
stored.getValue(),
hasDocValues.getValue(),
Expand All @@ -198,7 +198,7 @@ public ScaledFloatFieldMapper build(MapperBuilderContext context) {
indexMode
);
return new ScaledFloatFieldMapper(
name(),
leafName(),
type,
multiFieldsBuilder.build(this, context),
copyTo,
Expand Down Expand Up @@ -511,7 +511,7 @@ protected String contentType() {

@Override
public FieldMapper.Builder getMergeBuilder() {
return new Builder(simpleName(), ignoreMalformedByDefault, coerceByDefault, indexMode).metric(metricType).init(this);
return new Builder(leafName(), ignoreMalformedByDefault, coerceByDefault, indexMode).metric(metricType).init(this);
}

@Override
Expand Down Expand Up @@ -729,7 +729,7 @@ public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
"field [" + name() + "] of type [" + typeName() + "] doesn't support synthetic source because it declares copy_to"
);
}
return new SortedNumericDocValuesSyntheticFieldLoader(name(), simpleName(), ignoreMalformed.value()) {
return new SortedNumericDocValuesSyntheticFieldLoader(name(), leafName(), ignoreMalformed.value()) {
@Override
protected void writeValue(XContentBuilder b, long value) throws IOException {
b.value(decodeForSyntheticSource(value, scalingFactor));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public SearchAsYouTypeFieldMapper build(MapperBuilderContext context) {
NamedAnalyzer searchAnalyzer = analyzers.getSearchAnalyzer();

SearchAsYouTypeFieldType ft = new SearchAsYouTypeFieldType(
context.buildFullName(name()),
context.buildFullName(leafName()),
fieldType,
similarity.getValue(),
analyzers.getSearchAnalyzer(),
Expand All @@ -202,7 +202,7 @@ public SearchAsYouTypeFieldMapper build(MapperBuilderContext context) {
prefixft.setIndexOptions(fieldType.indexOptions());
prefixft.setOmitNorms(true);
prefixft.setStored(false);
final String fullName = context.buildFullName(name());
final String fullName = context.buildFullName(leafName());
// wrap the root field's index analyzer with shingles and edge ngrams
final Analyzer prefixIndexWrapper = SearchAsYouTypeAnalyzer.withShingleAndPrefix(
indexAnalyzer.analyzer(),
Expand All @@ -228,7 +228,7 @@ public SearchAsYouTypeFieldMapper build(MapperBuilderContext context) {
final int shingleSize = i + 2;
FieldType shingleft = new FieldType(fieldType);
shingleft.setStored(false);
String fieldName = getShingleFieldName(context.buildFullName(name()), shingleSize);
String fieldName = getShingleFieldName(context.buildFullName(leafName()), shingleSize);
// wrap the root field's index, search, and search quote analyzers with shingles
final SearchAsYouTypeAnalyzer shingleIndexWrapper = SearchAsYouTypeAnalyzer.withShingle(
indexAnalyzer.analyzer(),
Expand Down Expand Up @@ -260,7 +260,7 @@ public SearchAsYouTypeFieldMapper build(MapperBuilderContext context) {
ft.setPrefixField(prefixFieldType);
ft.setShingleFields(shingleFieldTypes);
return new SearchAsYouTypeFieldMapper(
name(),
leafName(),
ft,
copyTo,
indexAnalyzers,
Expand Down Expand Up @@ -721,7 +721,7 @@ protected String contentType() {
}

public FieldMapper.Builder getMergeBuilder() {
return new Builder(simpleName(), builder.indexCreatedVersion, builder.analyzers.indexAnalyzers).init(this);
return new Builder(leafName(), builder.indexCreatedVersion, builder.analyzers.indexAnalyzers).init(this);
}

public static String getShingleFieldName(String parentField, int shingleSize) {
Expand Down
Loading

0 comments on commit 7a8a84e

Please sign in to comment.