# Search api not returning the results

**URL:** <https://discuss.elastic.co/t/search-api-not-returning-the-results/263556>\
**Category:** Elasticsearch\
**Created:** [February 8, 2021, 7:54am UTC](https://discuss.elastic.co/t/search-api-not-returning-the-results/263556 "2021-02-08T07:54:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ritusingh](https://avatars.discourse-cdn.com/v4/letter/r/ac91a4/32.png) [@ritusingh](https://discuss.elastic.co/u/ritusingh)\
**Post date:** [February 8, 2021, 7:54am UTC](https://discuss.elastic.co/t/search-api-not-returning-the-results/263556/1 "2021-02-08T07:54:44Z")

</div>

Hi,  
I want to get the logs from all the indices in elasticsearch for which I am using following search API.

```auto
https://localhost:9200/_search?pretty=true

```

Output:

```auto
{
    "took": 28,
    "timed_out": false,
    "_shards": {
        "total": 77,
        "successful": 77,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 10000,
            "relation": "gte"
        },
        "max_score": 1,
        "hits": [
            {
                "_index": ".kibana_1",
                "_type": "_doc",
                "_id": "space:default",
                "_score": 1,
                "_source": {
                    "space": {
                        "name": "Default",
                        "description": "This is your default space!",
                        "color": "#00bfb3",
                        "disabledFeatures": [],
                        "_reserved": true
                    },
                    "type": "space",
                    "references": [],
                    "migrationVersion": {
                        "space": "6.6.0"
                    },
                    "updated_at": "2020-10-30T09:42:35.434Z"
                }
            },
            {
                "_index": ".kibana_1",
                "_type": "_doc",
                "_id": "visualization:9222cd00-1cd8-11eb-b9f1-333a51f1559f",
                "_score": 1,
                "_source": {
                    "visualization": {
                        "title": "customer_journey_table",
                        "visState": "{\"type\":\"table\",\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"host.keyword\",\"orderBy\":\"_key\",\"order\":\"asc\",\"size\":50,\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"host_name\"}},{\"id\":\"3\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"httpmethod.keyword\",\"orderBy\":\"_key\",\"order\":\"asc\",\"size\":50,\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"Http_method\"}},{\"id\":\"4\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"date_time.keyword\",\"orderBy\":\"1\",\"order\":\"asc\",\"size\":50,\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"date_time\"}}],\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMetricsAtAllLevels\":false,\"sort\":{\"columnIndex\":null,\"direction\":null},\"showTotal\":false,\"totalFunc\":\"sum\",\"percentageCol\":\"\"},\"title\":\"customer_journey_table\"}",
                        "uiStateJSON": "{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}",
                        "description": "",
                        "version": 1,
                        "kibanaSavedObjectMeta": {
                            "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}"
                        }
                    },
                    "type": "visualization",
                    "references": [
                        {
                            "name": "kibanaSavedObjectMeta.searchSourceJSON.index",
                            "type": "index-pattern",
                            "id": "162c0440-1cd4-11eb-b9f1-333a51f1559f"
                        }
                    ],
                    "migrationVersion": {
                        "visualization": "7.7.0"
                    },
                    "updated_at": "2020-11-02T06:56:45.520Z"
                }
            },
            {
                "_index": ".kibana_1",
                "_type": "_doc",
                "_id": "visualization:57550c70-1cd7-11eb-b9f1-333a51f1559f",
                "_score": 1,
                "_source": {
                    "visualization": {
                        "title": "Customer_journey",
                        "visState": "{\"type\":\"table\",\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"_id\",\"orderBy\":\"1\",\"order\":\"asc\",\"size\":50,\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"User_id\"}},{\"id\":\"3\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"host.keyword\",\"orderBy\":\"1\",\"order\":\"asc\",\"size\":50,\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"host_name\"}}],\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMetricsAtAllLevels\":false,\"sort\":{\"columnIndex\":null,\"direction\":null},\"showTotal\":false,\"totalFunc\":\"sum\",\"percentageCol\":\"\"},\"title\":\"Customer_journey\"}",
                        "uiStateJSON": "{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}",
                        "description": "",
                        "version": 1,
                        "kibanaSavedObjectMeta": {
                            "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}"
                        }
                    },
...........and so on.

```

Now the problem is, I am not getting the logs inserted by me under \_source (only index and some metadata). Please help.

---

<div class="post-metadata">

**Author:** ![rohitarorait82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rohitarorait82/32/82981_2.png) [@rohitarorait82](https://discuss.elastic.co/u/rohitarorait82)\
**Post date:** [February 8, 2021, 8:27am UTC](https://discuss.elastic.co/t/search-api-not-returning-the-results/263556/2 "2021-02-08T08:27:58Z")

</div>

> [@ritusingh](#):
>
> `https://localhost:9200/_search?pretty=true`

Hi @ritusingh : Can you please search with specific index name

`https://localhost:9200/ind_name/_search?pretty=true`

---

<div class="post-metadata">

**Author:** ![ritusingh](https://avatars.discourse-cdn.com/v4/letter/r/ac91a4/32.png) [@ritusingh](https://discuss.elastic.co/u/ritusingh)\
**Post date:** [February 8, 2021, 8:29am UTC](https://discuss.elastic.co/t/search-api-not-returning-the-results/263556/3 "2021-02-08T08:29:54Z")

</div>

Thanks for reply Rohit,  
If I go with specific index or even a wildcard expression like ola\*, it is working , but I want all the indices created by me.

---

<div class="post-metadata">

**Author:** ![rohitarorait82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rohitarorait82/32/82981_2.png) [@rohitarorait82](https://discuss.elastic.co/u/rohitarorait82)\
**Post date:** [February 8, 2021, 8:43am UTC](https://discuss.elastic.co/t/search-api-not-returning-the-results/263556/4 "2021-02-08T08:43:34Z")

</div>

@ritusingh : Can you try this  
POST [https://localhost:9200/\*/\_search](https://localhost:9200/*/_search)  
{  
"size": 500,  
"sort": [  
{  
"@timestamp": {  
"order": "desc",  
"unmapped\_type": "boolean"  
}  
}  
]  
}

---

<div class="post-metadata">

**Author:** ![ritusingh](https://avatars.discourse-cdn.com/v4/letter/r/ac91a4/32.png) [@ritusingh](https://discuss.elastic.co/u/ritusingh)\
**Post date:** [February 8, 2021, 9:20am UTC](https://discuss.elastic.co/t/search-api-not-returning-the-results/263556/5 "2021-02-08T09:20:53Z")

</div>

Thanks a lot Rohit. Its working 🙂

---

<div class="post-metadata">

**Author:** ![ritusingh](https://avatars.discourse-cdn.com/v4/letter/r/ac91a4/32.png) [@ritusingh](https://discuss.elastic.co/u/ritusingh)\
**Post date:** [February 9, 2021, 6:47am UTC](https://discuss.elastic.co/t/search-api-not-returning-the-results/263556/6 "2021-02-09T06:47:52Z")

</div>

Hi Rohit, there is one doubt , using this solution how can I avoid default indices like .kibana\_1, .apm\_monitoring etc? And also is it possible that I get only one log from each index?

---

<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:** [March 9, 2021, 6:48am UTC](https://discuss.elastic.co/t/search-api-not-returning-the-results/263556/7 "2021-03-09T06:48:15Z")

</div>

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