Comments (5)
It's definitely still invalid JSON - the JSON spec on http://www.json.org/ is clear that double quotes are required around string values, including object keys. In practice it's not a huge problem that elasticsearch accepts invalid JSON for the queries though, provided it also accepts valid JSON. The JSON output by elasticsearch uses quotes in the right places and is absolutely fine.
Python's JSON parser is strict by default, and throws the following exception if I feed in the above example:
ValueError: Expecting property name: line 2 column 5 (char 6)
from elasticsearch.
The invalid part I was talking about is the usage of the same field name twice within an object.
Regarding the quotes on field names, you are absolutely correct. ES does accept field names that are either quoted or not, for two reasons:
- Less text on the wire / simplifies writing examples :).
- Makes direct Javascript usage simpler.
from elasticsearch.
Actually, non-unique key names are invalid JSON. See section 2.2 in http://www.ietf.org/rfc/rfc4627.txt?number=4627
So whenever you have repeatable items, you should provide both:
{ key: value }
{ keys: [ value_1, value_n ] }
from elasticsearch.
or:
{ key: value } | { key: [ value_1, value_n] }
from elasticsearch.
They say SHOULD not must :). In any case, I will make sure in the future that the SHOULD, with all its uppercase glory, is maintained :).
from elasticsearch.
Related Issues (20)
- [CI] JvmGcMonitorServiceSettingsTests testNegativeSetting failing HOT 3
- [ML] Updating `model_memory_limit` wipes `categorization_examples_limit` HOT 1
- New Rally `low-latency` challenge in `tsdb` track HOT 2
- _ignored meta field index stats HOT 11
- [CI] ToDatetimeTests testFold {TestCase=<date string before 0001-01-01T00:00:00.000Z>} failing HOT 1
- ESQL: Optimize sorts across shards HOT 1
- ES|QL: HeapAttack.testTooManyEval failing on serverless HOT 1
- Query and query profile show different execution path for some queries like conjunctions HOT 1
- [CI] FloatRangeFieldMapperTests testSyntheticSourceMany failing HOT 1
- Add utility for asserting listeners are completed HOT 1
- Improve mechanism for extracting the result of a `PlainActionFuture` HOT 1
- IntegerRangeFieldMapperTests#testSyntheticSourceMany fails reproducibly HOT 1
- Open connections to new nodes more lazily HOT 1
- ESQL - EventStats (Aggregate & Get original events) command HOT 4
- Cross-cluster API key query not working when replication is also defined HOT 1
- Make single numeric value searching more performant HOT 1
- Increase the iteration count of KDF and stop using SHA1, 3DES and hardcoded credentials HOT 1
- Ability to use `rescore` with Inner hits HOT 3
- [DOCS] Missing information in Health API documentation HOT 3
- Health API returns details and diagnosis in non-verbose mode 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.