Comments (2)
Hi clarkb,
I've committed some additional unit tests that do a better job describing how to branch queries then i could probably type up:
I did a longish write up here on how to dynamically generate searchdescriptors here:
#52
I wrote that before NEST had proper &&, || and ! support and before it had a static Query
, Query<T>
, Filter
and Filter<T>
of which to spawn queries at will.
Hopefully i get around to writing some proper documentation on all the different query generation paths you can take (NEST has several) somewhere next week.
I hope this for now answers your question though.let me know if it doesn't!
from elasticsearch-net.
It still wasn't clear to me how to do this based on the additional tests, but I came up with the following:
var filter = Filter<Part>.Term(x => x.DivisionID, divisionId);
if (classId != "")
{
filter &= Filter<Part>.Query(f => f.QueryString(q => q.Query(classId).OnField(field => field.ClassID)));
}
if (subclassId != "")
{
filter &= Filter<Part>.Query(f => f.QueryString(q => q.Query(subclassId).OnField(field => field.SubClassID)));
}
Would that be the right way to do it? I now have to do something similar but this time I need to create a multiple-value "or" filter. Using the above example, I'd have a string array of division IDs and need to match on any of them. The array could be any length, so I'm not sure if I have to loop through it and add an or filter for each value or if I can pass in the string array to something as the set of values to match.
from elasticsearch-net.
Related Issues (20)
- NEST does not work with .Net 8 HOT 2
- Add FilterPath to SearchRequestDescriptor HOT 1
- Decay functions score is missing on version 8 HOT 1
- Support AOT compilation HOT 9
- Can't find the Indices "ExistsAsync" method to check if index exists? HOT 1
- No documentation on how to Sort when not using the Fluent Api HOT 4
- Indicies.Get call fails to deserialize ICollections properly in the IndexRequest HOT 3
- Cannot sort with nullable long - "No mapping found"
- "[query_string] query does not support [fields]" error HOT 8
- RawJsonString encodes script parameter into a string HOT 1
- BulkAsync serializes document with all fields as empty array HOT 1
- [Request feedback] Looking for feedback about the UX experience HOT 2
- Aggregations Filters :The JSON value could not be converted to System.Collections.Generic.IReadOnlyCollection`1[Elastic.Clients.Elasticsearch.Aggregations.FiltersBucket]. Path: $.buckets |
- Uneven distribution of docs across shards, even with auto-generated ids HOT 2
- Indices.UpdateAliases() not working as expected HOT 1
- Dll verion HOT 3
- Range types do not serialize with the correct property names HOT 1
- QueryStringQuery fails when a single field is set for the Fields array HOT 1
- Nested ordering ignoring filter results
- Remove netcoreapp3.1 and net5.0 from TargetFrameworks and add net8.0 HOT 1
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.