Comments (7)
I am OK with whatever you decide. I am just expressing personal opinion. 10x for the conversation
from elasticsearch-net.
Hi @mynkow,
the name is no longer part of the aggregation variant, so that part is expected to be missing.
The "field" constructor provides no real benefit over using the initializer syntax:
var agg = new SumAggregation { Field = field }
Is there a specific need for this constructor? Otherwise I'm going to document this change in the breaking changes list as I've definitely forgot to mention it so far 🙂
from elasticsearch-net.
hello @flobernd,
from coding perspective ctors indicate what minimum data (or combination) is required to have valid object for the rest of the flow. Is it valid to have a SumAggregation
without a Field
?
I see that the other properties are nullable but I think it is easier having a ctor.
from elasticsearch-net.
Hi @mynkow,
from coding perspective ctors indicate what minimum data (or combination) is required to have valid object for the rest of the flow
Yes, that's my understanding as well and I think the client should follow this pattern on most places (except for descriptors). Currently, the code base does not strictly implement nullability annotations. This is something I plan to improve in the future.
Is it valid to have a SumAggregation without a Field?
I was already wondering the same. According to our specification, Field
can be null
(this is as well one of the reasons for the code generator to not add field
as a required constructor argument). I fired a quick query without specifying field
and the response from the server was as follows:
Required one of fields [field, script], but none were specified.
This means, field
can indeed by null
, if script
is used instead.
Based on this observation, I think the removal of the constructor is valid. Do you agree with that?
from elasticsearch-net.
Maybe the best solution is to have 2 constructors in this situation. One with the field
and one with the script
because these are the minimum requirements from the server. This way developers will get faster feedback instead of runtime error.
What do you think?
from elasticsearch-net.
I agree, that this would be a good design, but it's very complex to model in our specification. This would require us to include semantics in the specification in order to express that either X
or Y
is required. While this particular case would probably be relatively easy to implement, there are more complex cases where e.g. X
is required only, if Y
contains a certain value and many other conditions which might even be dependent on state (e.g. mapping on a specific index field).
A better idea might be to improve documentation and mention these kinds of conditions there.
from elasticsearch-net.
Thank you as well for providing feedback 🙂 I'm always happy to improve things, if possible.
from elasticsearch-net.
Related Issues (20)
- Support for (alternative for) GeoShapeQuery HOT 2
- After/AfterKey dictionary types in Composite Aggregation/Aggregate HOT 1
- 8.13.10 lacks UpdateMany<TSource, TPartialDocument>
- Latest MINOR package version does not support .Net 6 anymore. HOT 3
- Elastic.Transport.UnexpectedTransportException with Indices.GetAsync HOT 4
- Indices.ExistsAsync throw exception due to ICU field HOT 6
- Queries are no longer derive from SearchQuery HOT 4
- Make it easy to log elastic requests HOT 3
- DefaultMappingFor IndexName is not respected in searches HOT 3
- Different classes between filters and return document HOT 3
- can't created repository,response request body missing HOT 1
- Elasticsearch health is accessible but .net client fails HOT 3
- Migration issues Templates and Dynamic queries HOT 2
- Client cannot deserialize string to list of strings
- [Feature] Elastic 8 - MatchAll won't accept passing nothing
- Creating a local stack s3 repository failed. use Postman works, but code calls are not working.
- [FEATURE] Elastic 8 Client - Stores Enums as Strings
- Cannot use RawJsonQuery HOT 1
- Encountered an unsupported variant tag '' on 'Analysis.INormalizer', which could not be deserialized
- Simplify IndexAsync Abstraction to Infer Index Name from TDocument Type
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elasticsearch-net.