Comments (8)
Has this been intentionally reverted? It seems according to https://www.elastic.co/guide/en/elasticsearch/reference/current/boolean.html and experimentally walking into it, that boolean type doesn't support 0 and 1 anymore.
from elasticsearch.
In JSON there is a specific type for boolean, its funny that its hard to set it. So, how do you imaging this, as {"explain" : "1"} or {"explain" : 1}?
from elasticsearch.
well, in dynamic languages that don't have a boolean type (eg Perl), false is
- 0
- undef / null
- ""
- "0"
and everything else is true.
Typically, we'd pass in 1 and 0 to represent true and false, but users could pass in anything. The one gotcha could be if they pass in 'true' or 'false', which would become "true" or "false", but at least in Perl users would be unlikely to do that.
from elasticsearch.
Ok, make sense. So, places where I parse the JSON and know what to expect, I can take care of that. But, how to you index a JSON document, are the boolean fields there used, or do you use numbers?
from elasticsearch.
Hmm, that's an interesting one...
Typically, most Perl users would use 1 / 0 (so Int). The module I'm using to encode the JSON provides the facility to represent a real JSON 'true' or 'false' by using \1 or \0 (which actually means "a reference to the scalar value 1")
Are you able to convert truthy/falsey values to real boolean values when indexing a field mapped as type: "boolean" ? If so, you may not want to enable it by default, so that users of typed languages don't complain.
But allow dynamic languages to pass a flag, perhaps?
And I'd put a a big GOTCHA warning in my docs explaining the need to use mappings before indexing.
from elasticsearch.
I do perform optimization when it comes to boolean fields. People can use 1 and 0, but they will be treated automatically as numbers when not explicitly defined in mapping. Even when explicitly defined in the mappings as boolean, only a boolean type is supported. I will add support for numbers as well.
from elasticsearch.
Opened #33 for the boolean type in JSON documents indexed.
from elasticsearch.
Accept also 0 int number to indicate false, and any other number to indicate true (on top of accepting json boolean type), closed by 3f045de.
from elasticsearch.
Related Issues (20)
- Permit pre-authorization of indexing actions HOT 1
- Datehistogram on DayLightSaving time range produces wrong buckets HOT 3
- illegal_argument_exception - unexpected metadata [op:[TEST]] in source HOT 8
- [CI] DownsampleActionSingleNodeTests testCannotDownsampleWhileOtherDownsampleInProgress failing HOT 3
- [Transforms] Transform has failed with "The object cannot be set twice" HOT 3
- [ES|QL] generate function docs and definitions for agg functions HOT 1
- [ES|QL] generate function docs and definitions for operators HOT 1
- Update Rally logs track to use new `logs` index mode HOT 2
- [ML] Inference Process output field behavior HOT 1
- [ML] Inference Process update the docs to state output field behavior HOT 2
- [ES|QL] High accuracy cardinality aggregation HOT 1
- [ML] Add timeout field to inference API HOT 1
- failed to retrieve shard stats from node [zxt4RAOiRZy9Lol9IdIGfg]: [node_2][10.202.152.18:9300][indices:monitor/stats[n]] request_id [77247 683] timed out after [15016ms] HOT 2
- [Transform] Elasticsearch upgrades make transforms fail easily HOT 10
- [Transform] IndexNotFoundException during cluster upgrade HOT 5
- `knn` query hits cache, but actually doesn't cache knn search HOT 5
- [Transform] Unattended are failing due to missing configuration HOT 5
- [CI] DiversifiedSamplerTests testDiversifiedSampler failing HOT 3
- Range fields are off by one when default values are used HOT 1
- [CI] EsqlActionTaskIT testTaskContentsForLimitQuery failing HOT 3
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.