# Search not working unless type specified

**URL:** <https://discuss.elastic.co/t/search-not-working-unless-type-specified/21567>\
**Category:** Elasticsearch\
**Created:** [January 9, 2015, 10:48pm UTC](https://discuss.elastic.co/t/search-not-working-unless-type-specified/21567 "2015-01-09T22:48:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stefanie](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@Stefanie](https://discuss.elastic.co/u/Stefanie)\
**Post date:** [January 9, 2015, 10:48pm UTC](https://discuss.elastic.co/t/search-not-working-unless-type-specified/21567/1 "2015-01-09T22:48:52Z")

</div>

I am having an issue with searching results if the type is not specified.

The following search request works correctly:

curl -XGET '[http://localhost:9200/twitter/tweet/\_search](http://localhost:9200/twitter/tweet/_search)' -d '{  
"query" : {"match\_all": {}},  
"filter": {  
"terms": {  
"tweet\_id":[  
128  
]  
}  
},  
"sort" : {"type" : "desc"}  
}  
'

But this search request does not return any results:

curl -XGET '[http://localhost:9200/twitter/\_search](http://localhost:9200/twitter/_search)' -d '{  
"query" : {"match\_all": {}},  
"filter": {  
"terms": {  
"tweet\_id":[  
128  
]  
}  
},  
"sort" : {"type" : "desc"}  
}  
'

Does anyone know why this is?

I am using elasticsearch version 0.90.13.

Thank you for all the help.  
Stefanie

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/31092564-4f29-4e45-a9e3-a8118838c5b5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/31092564-4f29-4e45-a9e3-a8118838c5b5%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 10, 2015, 10:29am UTC](https://discuss.elastic.co/t/search-not-working-unless-type-specified/21567/2 "2015-01-10T10:29:57Z")

</div>

That’s a very old version.  
I just tested this and was able to get results. Tested on elasticsearch 1.4.2

DELETE twitter  
PUT twitter/tweet/1  
{  
"type": "tweet",  
"tweet\_id": 128  
}

GET /twitter/tweet/\_search  
{  
"query" : {"match\_all": {}},  
"filter": {  
"terms": {  
"tweet\_id":[  
128  
]  
}  
},  
"sort" : {"type" : "desc"}  
}

# gives results

GET /twitter/\_search  
{  
"query" : {"match\_all": {}},  
"filter": {  
"terms": {  
"tweet\_id":[  
128  
]  
}  
},  
"sort" : {"type" : "desc"}  
}

# gives results

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr) | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)

> Le 9 janv. 2015 à 23:48, Stefanie [stefanie@backstit.ch](mailto:stefanie@backstit.ch) a écrit :
> 
> I am having an issue with searching results if the type is not specified.
> 
> The following search request works correctly:
> 
> curl -XGET '[http://localhost:9200/twitter/tweet/\_search](http://localhost:9200/twitter/tweet/_search)' -d '{  
> "query" : {"match\_all": {}},  
> "filter": {  
> "terms": {  
> "tweet\_id":[  
> 128  
> ]  
> }  
> },  
> "sort" : {"type" : "desc"}  
> }  
> '
> 
> But this search request does not return any results:
> 
> curl -XGET '[http://localhost:9200/twitter/\_search](http://localhost:9200/twitter/_search)' -d '{  
> "query" : {"match\_all": {}},  
> "filter": {  
> "terms": {  
> "tweet\_id":[  
> 128  
> ]  
> }  
> },  
> "sort" : {"type" : "desc"}  
> }  
> '  
> Does anyone know why this is?
> 
> I am using elasticsearch version 0.90.13.
> 
> Thank you for all the help.  
> Stefanie
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) [mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/31092564-4f29-4e45-a9e3-a8118838c5b5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/31092564-4f29-4e45-a9e3-a8118838c5b5%40googlegroups.com) [https://groups.google.com/d/msgid/elasticsearch/31092564-4f29-4e45-a9e3-a8118838c5b5%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/31092564-4f29-4e45-a9e3-a8118838c5b5%40googlegroups.com?utm_medium=email&utm_source=footer).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout) [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6B050A32-21EE-4FF8-A299-A0BFE36A870B%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/6B050A32-21EE-4FF8-A299-A0BFE36A870B%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Stefanie](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@Stefanie](https://discuss.elastic.co/u/Stefanie)\
**Post date:** [January 12, 2015, 2:33pm UTC](https://discuss.elastic.co/t/search-not-working-unless-type-specified/21567/3 "2015-01-12T14:33:46Z")

</div>

I get the correct behavior with the other document type in this index and  
my other index has had no issues with having multiple document types being  
returned. So I am not sure what is going on with this document type. Do  
you have any ideas?

Thanks

On Saturday, January 10, 2015 at 5:30:21 AM UTC-5, David Pilato wrote:

> That’s a very old version.  
> I just tested this and was able to get results. Tested on elasticsearch  
> 1.4.2
> 
> DELETE twitter  
> PUT twitter/tweet/1  
> {  
> "type": "tweet",  
> "tweet\_id": 128  
> }
> 
> GET /twitter/tweet/\_search  
> {  
> "query" : {"match\_all": {}},  
> "filter": {  
> "terms": {  
> "tweet\_id":[  
> 128  
> ]  
> }  
> },  
> "sort" : {"type" : "desc"}  
> }
> 
> # gives results
> 
> GET /twitter/\_search  
> {  
> "query" : {"match\_all": {}},  
> "filter": {  
> "terms": {  
> "tweet\_id":[  
> 128  
> ]  
> }  
> },  
> "sort" : {"type" : "desc"}  
> }
> 
> # gives results
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)  
> [http://Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr) | @scrutmydocs  
> [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> 
> Le 9 janv. 2015 à 23:48, Stefanie \<stef...@backstit.ch \<javascript:\>\> a  
> écrit :
> 
> I am having an issue with searching results if the type is not specified.
> 
> The following search request works correctly:
> 
> curl -XGET '[http://localhost:9200/twitter/tweet/\_search](http://localhost:9200/twitter/tweet/_search)' -d '{  
> "query" : {"match\_all": {}},  
> "filter": {  
> "terms": {  
> "tweet\_id":[  
> 128  
> ]  
> }  
> },  
> "sort" : {"type" : "desc"}  
> }  
> '
> 
> But this search request does not return any results:
> 
> curl -XGET '[http://localhost:9200/twitter/\_search](http://localhost:9200/twitter/_search)' -d '{  
> "query" : {"match\_all": {}},  
> "filter": {  
> "terms": {  
> "tweet\_id":[  
> 128  
> ]  
> }  
> },  
> "sort" : {"type" : "desc"}  
> }  
> '
> 
> Does anyone know why this is?
> 
> I am using elasticsearch version 0.90.13.
> 
> Thank you for all the help.  
> Stefanie
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/31092564-4f29-4e45-a9e3-a8118838c5b5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/31092564-4f29-4e45-a9e3-a8118838c5b5%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/31092564-4f29-4e45-a9e3-a8118838c5b5%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/31092564-4f29-4e45-a9e3-a8118838c5b5%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/9e5a8359-d442-4ae8-86ea-ca185afe1d98%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9e5a8359-d442-4ae8-86ea-ca185afe1d98%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 12, 2015, 2:41pm UTC](https://discuss.elastic.co/t/search-not-working-unless-type-specified/21567/4 "2015-01-12T14:41:36Z")

</div>

No I don’t and I can’t really help until I know exactly what you are doing.  
But may be others have ideas?

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr) | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)

> Le 12 janv. 2015 à 15:33, Stefanie [stefanie@backstit.ch](mailto:stefanie@backstit.ch) a écrit :
> 
> I get the correct behavior with the other document type in this index and my other index has had no issues with having multiple document types being returned. So I am not sure what is going on with this document type. Do you have any ideas?
> 
> Thanks
> 
> On Saturday, January 10, 2015 at 5:30:21 AM UTC-5, David Pilato wrote:  
> That’s a very old version.  
> I just tested this and was able to get results. Tested on elasticsearch 1.4.2
> 
> DELETE twitter  
> PUT twitter/tweet/1  
> {  
> "type": "tweet",  
> "tweet\_id": 128  
> }
> 
> GET /twitter/tweet/\_search  
> {  
> "query" : {"match\_all": {}},  
> "filter": {  
> "terms": {  
> "tweet\_id":[  
> 128  
> ]  
> }  
> },  
> "sort" : {"type" : "desc"}  
> }
> 
> # gives results
> 
> GET /twitter/\_search  
> {  
> "query" : {"match\_all": {}},  
> "filter": {  
> "terms": {  
> "tweet\_id":[  
> 128  
> ]  
> }  
> },  
> "sort" : {"type" : "desc"}  
> }
> 
> # gives results
> 
> --  
> David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com) [http://elasticsearch.com/](http://elasticsearch.com/)  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr) | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> 
> > Le 9 janv. 2015 à 23:48, Stefanie \<stef...@backstit.ch \<javascript:\>\> a écrit :
> > 
> > I am having an issue with searching results if the type is not specified.
> > 
> > The following search request works correctly:
> > 
> > curl -XGET '[http://localhost:9200/twitter/tweet/\_search](http://localhost:9200/twitter/tweet/_search)' [http://localhost:9200/twitter/tweet/\_search'](http://localhost:9200/twitter/tweet/_search') -d '{  
> > "query" : {"match\_all": {}},  
> > "filter": {  
> > "terms": {  
> > "tweet\_id":[  
> > 128  
> > ]  
> > }  
> > },  
> > "sort" : {"type" : "desc"}  
> > }  
> > '
> > 
> > But this search request does not return any results:
> > 
> > curl -XGET '[http://localhost:9200/twitter/\_search](http://localhost:9200/twitter/_search)' [http://localhost:9200/twitter/\_search'](http://localhost:9200/twitter/_search') -d '{  
> > "query" : {"match\_all": {}},  
> > "filter": {  
> > "terms": {  
> > "tweet\_id":[  
> > 128  
> > ]  
> > }  
> > },  
> > "sort" : {"type" : "desc"}  
> > }  
> > '  
> > Does anyone know why this is?
> > 
> > I am using elasticsearch version 0.90.13.
> > 
> > Thank you for all the help.  
> > Stefanie
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/31092564-4f29-4e45-a9e3-a8118838c5b5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/31092564-4f29-4e45-a9e3-a8118838c5b5%40googlegroups.com) [https://groups.google.com/d/msgid/elasticsearch/31092564-4f29-4e45-a9e3-a8118838c5b5%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/31092564-4f29-4e45-a9e3-a8118838c5b5%40googlegroups.com?utm_medium=email&utm_source=footer).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout) [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) [mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/9e5a8359-d442-4ae8-86ea-ca185afe1d98%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9e5a8359-d442-4ae8-86ea-ca185afe1d98%40googlegroups.com) [https://groups.google.com/d/msgid/elasticsearch/9e5a8359-d442-4ae8-86ea-ca185afe1d98%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/9e5a8359-d442-4ae8-86ea-ca185afe1d98%40googlegroups.com?utm_medium=email&utm_source=footer).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout) [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/AA766C06-A7BC-499B-8F9F-EA7167B9D2C0%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/AA766C06-A7BC-499B-8F9F-EA7167B9D2C0%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![cdahlqvist](https://avatars.discourse-cdn.com/v4/letter/c/9fc348/32.png) [@cdahlqvist](https://discuss.elastic.co/u/cdahlqvist)\
**Post date:** [January 12, 2015, 3:30pm UTC](https://discuss.elastic.co/t/search-not-working-unless-type-specified/21567/5 "2015-01-12T15:30:59Z")

</div>

What does your mapping for the index look like? Is there any possibility  
there could be a mapping conflict?

Christian

On Friday, January 9, 2015 at 10:48:52 PM UTC, Stefanie wrote:

> I am having an issue with searching results if the type is not specified.
> 
> The following search request works correctly:
> 
> curl -XGET '[http://localhost:9200/twitter/tweet/\_search](http://localhost:9200/twitter/tweet/_search)' -d '{  
> "query" : {"match\_all": {}},  
> "filter": {  
> "terms": {  
> "tweet\_id":[  
> 128  
> ]  
> }  
> },  
> "sort" : {"type" : "desc"}  
> }  
> '
> 
> But this search request does not return any results:
> 
> curl -XGET '[http://localhost:9200/twitter/\_search](http://localhost:9200/twitter/_search)' -d '{  
> "query" : {"match\_all": {}},  
> "filter": {  
> "terms": {  
> "tweet\_id":[  
> 128  
> ]  
> }  
> },  
> "sort" : {"type" : "desc"}  
> }  
> '
> 
> Does anyone know why this is?
> 
> I am using elasticsearch version 0.90.13.
> 
> Thank you for all the help.  
> Stefanie

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/06708810-cadf-49e2-8cbc-01730ed4b600%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/06708810-cadf-49e2-8cbc-01730ed4b600%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 12:39am UTC](https://discuss.elastic.co/t/search-not-working-unless-type-specified/21567/6 "2017-07-06T00:39:32Z")

</div>


