# Elasticsearch's JSON APIs are very difficult to remember and understand,very bad design!

**URL:** <https://discuss.elastic.co/t/elasticsearchs-json-apis-are-very-difficult-to-remember-and-understand-very-bad-design/17576>\
**Category:** Elasticsearch\
**Created:** [May 18, 2014, 8:56am UTC](https://discuss.elastic.co/t/elasticsearchs-json-apis-are-very-difficult-to-remember-and-understand-very-bad-design/17576 "2014-05-18T08:56:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wang\_guan](https://avatars.discourse-cdn.com/v4/letter/w/e47774/32.png) [@wang\_guan](https://discuss.elastic.co/u/wang_guan)\
**Post date:** [May 18, 2014, 8:56am UTC](https://discuss.elastic.co/t/elasticsearchs-json-apis-are-very-difficult-to-remember-and-understand-very-bad-design/17576/1 "2014-05-18T08:56:16Z")

</div>

for example:

{  
"match" : {  
"message" : {  
"query" : "to be or not to be",  
"operator" : "and",  
"zero\_terms\_query": "all"  
}  
}  
}

which field is part of the target documents and which field is part of  
query syntax???  
What i can do is try my best to remember the key word field such as "match"  
"query" ...,  
Why don't give the key word a symbol to distinct from the document field  
like mongodb's query language ....

very bad elasticsearch json API design!!!!!!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/0db5b06a-f70a-4422-95a6-f1fc7ee110b3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0db5b06a-f70a-4422-95a6-f1fc7ee110b3%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [May 18, 2014, 12:44pm UTC](https://discuss.elastic.co/t/elasticsearchs-json-apis-are-very-difficult-to-remember-and-understand-very-bad-design/17576/2 "2014-05-18T12:44:24Z")

</div>

- "match" \<== This is the query type, called "match"
- "message" \<== This is the field in the document you wish to query
- "query" \<== This is the text you wish to query with
- "operator" \<== This says how the terms in the query should be  
combined. Optional. Setting to "and" means all terms are required
- "zero\_terms\_query" \<== Special behavior in case the analyzer removes  
all tokens

I would encourage you to read "Elasticsearch - The Definitive Guide"[http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/index.html](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/index.html)if you are having trouble with the syntax. It walks through how to  
construct (and think about) queries, as well as many other topics.

very bad elasticsearch json API design!!!!!!

Well, this is a matter of opinion 😉 I quite like the API for example.  
There is a learning curve for sure, like any new technology, but once you  
understand the syntax and grammar, it is very powerful and easy to  
construct.

-Zach

On Sunday, May 18, 2014 4:56:16 AM UTC-4, wang guan wrote:

> for example:
> 
> {  
> "match" : {  
> "message" : {  
> "query" : "to be or not to be",  
> "operator" : "and",  
> "zero\_terms\_query": "all"  
> }  
> }  
> }
> 
> which field is part of the target documents and which field is part of  
> query syntax???  
> What i can do is try my best to remember the key word field such as  
> "match" "query" ...,  
> Why don't give the key word a symbol to distinct from the document field  
> like mongodb's query language ....
> 
> very bad elasticsearch json API design!!!!!!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/95538abe-5b1d-45c8-bc1d-062134784090%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/95538abe-5b1d-45c8-bc1d-062134784090%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:28am UTC](https://discuss.elastic.co/t/elasticsearchs-json-apis-are-very-difficult-to-remember-and-understand-very-bad-design/17576/3 "2017-07-06T01:28:38Z")

</div>


