Most Common Queries

Here we show some very simple queries to get you up-to-speed with ElasticSearch:

How to Know that you have Made a Bad Query

ElasticSearch is not very friendly with regards to pointing out errors in most cases. All its parser does is check for valid JSON. It does not check for valid queries. So, the only way you know if you have written an invalid query is that the score for all the documents it returns will be 0.0, like this example.

πŸ“˜

Other Way to Know your Query is Invalid

If you write something that the Law Insider endpoint does not understand it will return HTML. That means it did not even get to ElasticSearch.

"hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : 0.0,
    "hits" : [
      {
        "_index" : "category",
        "_type" : "_doc",
        "_id" : "en/intercreditor-and-security-sharing-agreement",
        "_score" : 0.0,
        "_source" : {
          "namespace" : "en",
          "group_id" : "intercreditor-and-security-sharing-agreement",
          "name" : "Intercreditor and Security Sharing Agreement",
          "type" : "category",
          "value" : "intercreditor-and-security-sharing-agreement",
          "weight" : 1,
          "weight_rank" : 1.0,
          "count" : 1.0,
          "suggest_sayt" : "Intercreditor and Security Sharing Agreement"
        }
      },