-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Accept 1 / 0 as true/false #26
Comments
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}? |
well, in dynamic languages that don't have a boolean type (eg Perl), false is
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. |
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? |
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. |
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. |
Opened #33 for the boolean type in JSON documents indexed. |
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. |
elasticsearch 1.2.0 has been released. We need to update from SNAPSHOT to released version. Closes #26. (cherry picked from commit ae3f3c23e3fde3b2327c1b5d759ff27675ecb40c)
Closes #26. (cherry picked from commit 60b7c55)
When listing existing blobs for an azure repository, `path` to look at is incorrectly computed which leads to 404 errors. Closes #26. (cherry picked from commit 656fadc)
We now generate `content_length` field field based on file size. Closes elastic#26.
Miscellaneous fixes/clarifications to log messages that arose in tracking down elastic#26.
) Previously, if the leader is a quorum all by itself then the call to safeAddHeartbeatResponse(localNode) would immediately renew the leader's lease, skipping the call to start() and suppressing sending heartbeats to all the other nodes. This breaks the assertion that, after stabilisation, all other connected nodes are followers, because they become candidates if they do not receive heartbeats. After this change we call start() first so that heartbeats are always sent.
Changed conditions on tasks to just use boolean instead of a string.
* Added bulksize challenge variation * Updated following review * Updated following review
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. |
Hiya
When you have boolean parameters, eg { "explain": true }, please could you accept any truthy value (eg 1) as for dynamic languages, the user has to go to great lengths to force a boolean true in JSON
thanks
clint
The text was updated successfully, but these errors were encountered: