Can I put a comment in an Elasticsearch request?

Can I put a comment in an Elasticsearch JSON request? I want to add additional text to a request that is read by a person but ignored by Elasticsearch.

For example, if I have the following query:

{ "query": { "match_all": {} } }

I would like to add a comment, maybe something like this:

{ "query": { "match_all": {} }, "comment": "This query matches all documents." }

Hack workarounds will also be appreciated (for example, a query suggestion that does not affect the results).

+8
source share
2 answers

One solution to this work is to use named queries , that is, each query can be named

{
  "query": {
    "match_all": {
      "_name": "This query matches all documents."
    }
  }
}
+4
source

, Elasticsearch Javascript (/* */ //) JSON ( , JSON ). .

+1

Source: https://habr.com/ru/post/1672498/


All Articles