# Help with query in CLI

**URL:** <https://discuss.elastic.co/t/help-with-query-in-cli/287584>\
**Category:** Elasticsearch\
**Created:** [October 25, 2021, 1:52pm UTC](https://discuss.elastic.co/t/help-with-query-in-cli/287584 "2021-10-25T13:52:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_Hatfield](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_hatfield/32/96306_2.png) [@Nick\_Hatfield](https://discuss.elastic.co/u/Nick_Hatfield)\
**Post date:** [October 25, 2021, 1:52pm UTC](https://discuss.elastic.co/t/help-with-query-in-cli/287584/1 "2021-10-25T13:52:11Z")

</div>

Hi guys, please help me understand how to make a query work from the cli. I either match too much or nothing at all...

So here's the payload sample:

```auto
{
  "took": 3,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 172,
    "max_score": 2.0947983,
    "hits": [
      {
        "_index": "hnt-fnxo5ynwr4m0tu87tm7xk5qct.2021-10-25",
        "_type": "_doc",
        "_id": "x8bsrVrJWitAyfX",
        "_score": 2.0947983,
        "_source": {
          "data": [
            {}
          ],
          "docId": "hotspot.collector.activity.1635129209",
          "collectionTime": "2021-10-25T02:33:29"
        }
      }
    ]
  }
}

```

Im using a curl command to retrieve this data from Elasticsearch. I supply a query like this.

```auto
{
  "query": {
    "query_string": {
      "query": "hotspot.collector.activity",
      "default_field": "docId"
    }
  }
}

```

And I get in return:

```auto
hotspot.collector.activity
hotspot.collector.activity.1635129209
hotspot.collector.activity.1635129208
hotspot.collector.rewards
hotspot.collector.rewards.1635129209

```

How can I return only the ones that match `hotspot.collector.activity` including the `hotspot.collector.activity.*` but NOT the others like `hotspot.collector.rewards`

Thanks!!

---

<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:** [November 22, 2021, 1:52pm UTC](https://discuss.elastic.co/t/help-with-query-in-cli/287584/2 "2021-11-22T13:52:57Z")

</div>

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