Difference between Hits and Hits(total)

Hi at all,

I'm new here and am trying to create a few charts with vega-lite. With some help from here some bars are to be seen. But I have a problem with the amount of records wich are given from the request. Although my index contains 12 records the result of the request delivers only 10.

The request looks like that:

{
  "query": {
    "bool": {
      "must": [],
      "filter": [],
      "should": [],
      "must_not": []
    }
  }
}

A common chart created in lens shows all 12 records. What is the reason for the differnce?

Thanks in advance
Joerg

"Hits" refers to the number of hits actually returned from the query. This is limited by the size parameter sent in the request to Elasticsearch (which defaults to 10).

"Hits (total)" refers to the total number of hits that match the query, not the number of results returned.

@thank u lukas.

with a little bit try and error I found now that the 'size' is to be placed into a body-tag. The next step for me is to sort the data. That works fine within the console

post umsatz06/_search
{
  "query": {
    "bool": {
      "must": [],
      "filter": [],
      "should": [],
      "must_not": []
    }
  },
  "size":"12",
  "sort":"Umsatz"
}

but it fails in the context of my chart

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "description": "A simple bar chart",
  "data": {
    "url": {
        "index":"umsatz06",
        "%context%":true,
        "body":{
          "size":12,
          "sort":"Umsatz"
        }
    }
    "format": {"property": "hits.hits"}
  },
  "mark": "bar",
  "encoding": {
    "x": {"field": "_source.Monat" "type": "nominal", "axis": {"labelAngle": 0}},
    "y": {"field": "_source.Umsatz" "type": "quantitative"}
  }
}

So my intention is not that the community build my charts. I would be very happy, if you can show me these parts of documentation which describe the DATA- and the URL-part that I have to use to get success.

regards joerg

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.