-
Notifications
You must be signed in to change notification settings - Fork 1.2k
9.0 Preview 1 Feedback #8496
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
Comments
Hey @niemyjski, thanks for the feedback. This format works perfectly well for me! I'll have a detailed look in a few hours :-) |
1.Ah, I see. This does not work, because all (most) of the fluent methods are using this signature: public SearchRequestDescriptor<TDocument> Query(Action<QueryDescriptor<TDocument>> action) The instance of Your code example does not mutate the original instance, but implicitly creates a new one by using the public SearchRequestDescriptor<TDocument> Query(Func<QueryDescriptor<TDocument>, QueryDescriptor<TDocument>> action) I can see that this might be useful, but I have to think about the implications in detail. It would definitely increase complexity quite a bit, since it would have to be implemented for all complex cases ( This might be something that can be added in one of the upcoming patch releases. Workaround: Not as convenient, but declaring/creating the descriptor beforehand, works fine: var combined =
new QueryDescriptor<MyType>().Term(m => m.Field(tf => tf.Field1).Value("value1")) ||
!new QueryDescriptor<MyType>().Term(m => m.Field(tf => tf.Field2).Value("value2"));
await client.SearchAsync<MyType>(d => d
.Indices("blah")
.Query(combined)); 2.This method is no longer required due to the container type improvements. It was as well problematic since it was only matching the type, but not the actual variant name (some containers have multiple variants with the same type in which case this method would just "randomly" returns a result). The new recommended way of inspecting container types is to use simple pattern matching: var query = new Query();
if (query.Nested is { } nested)
{
// We have a nested query.
} Thanks for pointing this out. I'll add a few lines about this to the release notes/changelog 🙂 3.Just use the var bounds = new ExtendedBounds<FieldDateMath> { Min = DateTime.UtcNow, Max = DateTime.UtcNow };
var agg = new DateHistogramAggregation
{
Field = "field",
ExtendedBounds = bounds
};
4.Thanks, I'll make sure to explicitly mention this in the release notes. This is part of the ordering improvements. 5.Right, this is a specification related change. The codegen name hint changed to 6.Yes, this is correct.
I'll hand-craft this union in the future to improve usability. This had rather low priority and did not make it in the 9.0 release. 7.This change is not intended. Thanks for reporting, I'll try to fix it before the 9.0 release. 8.Good spot as well! I handcrafted the overloads with the old names, but used the wrong name for the partial class which caused them to not show up. 9.This is actually a breaking change from 8.0 (or maybe 8.13) and the related usability issue is tracked in #8455. From a codegen perspective, this is a horrible function since the "nested property" semantics are not captured in the specification and hardcoding conditions in the code generator is always something I try to avoid at all costs. For usability, it would be good, if the generic type of the selected property is pushed down when using Currently, this leads to longer property select expressions, since the whole property path from the top level type to the nested property must always be specified. 10.A very valid point that I as well noticed. Sadly, I don't have a good solution for this right now. The arguments are ordered alphabetically which causes these little inconsistencies. One option is to use named arguments 11.Oh, I never saw that syntax before 😅 I can definitely bring that back with a slightly different syntax like e.g. [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
internal static Elastic.Clients.Elasticsearch.QueryDsl.Query Build(System.Action<Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor> action)
{
var builder = new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance));
action.Invoke(builder);
return builder.Instance;
} |
Thanks again. |
References: #8485
Let me know if this format works best or you'd like new issues for each. I just got started as it was a busy weekend. Anything logged here is feedback addressing 9.0.
1. Query logical operators compiler errors.
2. Query.TryGet<>(out)
This method seems to be missing on query we used this to do some parent child behavior in our query visitors.
3. ExtendedBounds conversion to DateHistogramAggregation.ExtendedBounds
We might need an implicit conversion here?
4. SortOptions.Field usage
This was working in 8.0 but not mentioned in release notes.
converted to
5. GetMappingResponse.Indicies
I'm logging this one as I didn't see anything in the previous release notes and this was compiling in 8 to my knowledge. Previously we were calling
Seems like this might need to change to:
var mapping = response.Mappings.FirstOrDefault().Value?.Mappings;
6. GeohashPrecision (constructor overloads)
Previous we passed a double to GeohashPrecision which now only takes a long or a string. I think this is now the correct behavior but just wanted to double check.
7. CountAsync requires parameters.
This seems like it should be allowed by default to get the count of everything in a repository. This is a breaking change from 8.
8. Range Queries breaking change.
Undocumented breaking change with TermRange and DateRange
to
9. Nested Mappings Breaking Changes
This was undocumented, really like this change for consistency but it might break a lot of people.
to
However the dictionary case might be breaking intellisense as I'm getting auto completion for the top level fields..
to
10. GeoDistanceQuery, GeoBoundingBoxQuery, TopLeftBottomRightGeoBounds parameter order.
I typed field in wrong which feels like what most of the api surface accepts as the first parameter. Feels like this should be looked over to make it feel more uniform.
for TopLeftBottomRightGeoBounds, it seems like the order should match the method name.

11. Query Generics for easier query generation.
We have the generic query client which gives us field inference/autocomplete. Any chance this can be brought back? Or a great solution for it?
The text was updated successfully, but these errors were encountered: