Comments (4)
@defgenx thanks for getting back!
Ok got it!
The reason why this was confusing for me:
I would have expected
must do
bool do
should do
term color: red
term color: blue
end
end
end
to create
"must": [
{
"bool": {
"should": [
{"term": {"color": "red"}},
{"term": {"color": "blue"}}
]
}
}
]
But based on my experience so far (might be wrong) it just creates the first "term" and drops the second one silently without any error
"must": [
{
"bool": {
"should": [
{"term": {"color": "red"}},
]
}
}
]
No error message - just different json output than i'd have expected from the ruby dsl (assuming it's meant to mirror the json syntax)
must do
bool do
should { term color: red }
should { term color: blue }
end
end
end
creates the correct result as you described
from elasticsearch-dsl-ruby.
I think this issue could be solved just by improving documentation
from elasticsearch-dsl-ruby.
➕ I just ran into this same issue
from elasticsearch-dsl-ruby.
@andreasklinger It is by design.
Here is a link for complex queries. Maybe this can help you a little : https://github.com/elastic/elasticsearch-rails/blob/master/elasticsearch-rails/lib/rails/templates/searchable.dsl.rb#L73
You can use a terms
query for your 'color' field and delete the nested bool query (not tested but I think it should work).
from elasticsearch-dsl-ruby.
Related Issues (20)
- [elasticsearch-dsl] BaseAggregationComponent#to_hash pollutes @hash
- distance_feature support? HOT 1
- Sampler Aggregation in elasticsearch-dsl HOT 1
- Support for calendar_interval
- Missing match_phrase query on elasticsearch-dsl
- date_histogram combined interval field is deprecated
- DSL AST initialisation recursively searches up namespaces for consts
- Example request: Sorting by nested attribute value
- Initialize an instance of Search from_hash
- Other bucket aggregation support HOT 1
- Not able to specify missing_value in aggregation
- How to combine bool query must with should
- How to use DSL HOT 1
- Global Aggregations HOT 3
- [DSL] Support for non-search DSLs? HOT 2
- DSL constantizes & instantiates a class on method_missing
- Inconsistent getters and setters HOT 7
- Nested bool filters not supported? HOT 5
- Elasticsearch::DSL filters aggregation does not support the other_bucket or other_bucket_key options 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-dsl-ruby.