# No results in REST API

**URL:** <https://discuss.elastic.co/t/no-results-in-rest-api/17633>\
**Category:** Elasticsearch\
**Created:** [May 21, 2014, 4:29am UTC](https://discuss.elastic.co/t/no-results-in-rest-api/17633 "2014-05-21T04:29:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pratik\_Poddar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pratik_poddar/32/1529_2.png) [@Pratik\_Poddar](https://discuss.elastic.co/u/Pratik_Poddar)\
**Post date:** [May 21, 2014, 4:29am UTC](https://discuss.elastic.co/t/no-results-in-rest-api/17633/1 "2014-05-21T04:29:29Z")

</div>

When I am doing es.search using pyelasticsearch I am able to get results,  
but doing REST API, I do not get results. Please help. Thanks

searchdoc yields results but rest api gives 0 hits.

py elastic search settings:  
bodyquery = {  
"custom\_score": {  
"script" : "\_score \*  
("+str(1.0+recency)+"\*\*(doc['articleid'].value\*50000.0/"+maxarticleid+"))",  
"query": {  
"query\_string": {"query": "Arvind", "fields":  
["text", "title^3", "domain"]}  
}  
}  
}

REST API query:  
[http://46.137.209.142:9200/article-index/article/\_search?q=Arvind](http://46.137.209.142:9200/article-index/article/_search?q=Arvind)

My indexing settings are:

```
                'settings': {
                        'analysis': {
                                'analyzer': {
                                        'my_ngram_analyzer' : {
                                                'tokenizer' :

```

'my\_ngram\_tokenizer',  
'filter':  
['my\_synonym\_filter']  
}  
},  
'filter': {  
'my\_synonym\_filter': {  
'type': 'synonym',  
'format': 'wordnet',  
'synonyms\_path':  
'analysis/wn\_s.pl'  
}  
},  
'tokenizer' : {  
'my\_ngram\_tokenizer' : {  
'type' : 'nGram',  
'min\_gram' : '1',  
'max\_gram' : '50'  
}  
}  
}  
},  
'mappings': {  
'article': {  
'\_all': {  
'enabled': False  
},  
'\_source': {  
'compressed': True  
},  
'properties': {  
'tags': {  
'type': 'string',  
'index':  
'not\_analyzed'  
}  
}  
}  
}

Thanks. Please advise.

--  
Pratik Poddar  
[www.linkedin.com/in/pratikpoddar](http://www.linkedin.com/in/pratikpoddar)

> **[CSE Blog - quant, math, computer science puzzles](http://www.cseblog.com)**
>
> Quant, Math & Computer Science Puzzles for Interview Preparation & Brain Teasing A collection of ~225 Puzzles with Solutions (classified by difficulty and topic)

  

> **[Pratik Poddar's Web Space](https://pratikpoddar.wordpress.com/)**
>
> Visit the post for more.

--  
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/CAFiYsPdbbG3o4cS2qcv-ND2-xcp7xh84Z%3DWDOhv3-rEm0VsQbw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFiYsPdbbG3o4cS2qcv-ND2-xcp7xh84Z%3DWDOhv3-rEm0VsQbw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [May 21, 2014, 7:19am UTC](https://discuss.elastic.co/t/no-results-in-rest-api/17633/2 "2014-05-21T07:19:43Z")

</div>

It looks like your python query doesn't specify the index and the type to  
query, so the equivalent REST call would rather look like:

[http://46.137.209.142:9200/\_search?q=Arvind](http://46.137.209.142:9200/_search?q=Arvind)

On Wed, May 21, 2014 at 6:29 AM, Pratik Poddar [pratik.phodu@gmail.com](mailto:pratik.phodu@gmail.com)wrote:

> When I am doing es.search using pyelasticsearch I am able to get results,  
> but doing REST API, I do not get results. Please help. Thanks
> 
> searchdoc yields results but rest api gives 0 hits.
> 
> py Elasticsearch settings:  
> bodyquery = {  
> "custom\_score": {  
> "script" : "\_score \*  
> ("+str(1.0+recency)+"\*\*(doc['articleid'].value\*50000.0/"+maxarticleid+"))",  
> "query": {  
> "query\_string": {"query": "Arvind", "fields":  
> ["text", "title^3", "domain"]}  
> }  
> }  
> }
> 
> REST API query:  
> [http://46.137.209.142:9200/article-index/article/\_search?q=Arvind](http://46.137.209.142:9200/article-index/article/_search?q=Arvind)
> 
> My indexing settings are:
> 
> ```
> 'settings': {
> 'analysis': {
> 'analyzer': {
> 'my_ngram_analyzer' : {
> 'tokenizer' :
> 
> ```
> 
> 'my\_ngram\_tokenizer',  
> 'filter':  
> ['my\_synonym\_filter']  
> }  
> },  
> 'filter': {  
> 'my\_synonym\_filter': {  
> 'type': 'synonym',  
> 'format': 'wordnet',  
> 'synonyms\_path':  
> 'analysis/wn\_s.pl'  
> }  
> },  
> 'tokenizer' : {  
> 'my\_ngram\_tokenizer' : {  
> 'type' : 'nGram',  
> 'min\_gram' : '1',  
> 'max\_gram' : '50'  
> }  
> }  
> }  
> },  
> 'mappings': {  
> 'article': {  
> '\_all': {  
> 'enabled': False  
> },  
> '\_source': {  
> 'compressed': True  
> },  
> 'properties': {  
> 'tags': {  
> 'type': 'string',  
> 'index':  
> 'not\_analyzed'  
> }  
> }  
> }  
> }
> 
> Thanks. Please advise.
> 
> --  
> Pratik Poddar  
> [Pratik Poddar - Nexus Venture Partners | LinkedIn](http://www.linkedin.com/in/pratikpoddar)  
> [http://www.cseblog.com](http://www.cseblog.com)  
> [http://pratikpoddar.wordpress.com/](http://pratikpoddar.wordpress.com/)
> 
> --  
> 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/CAFiYsPdbbG3o4cS2qcv-ND2-xcp7xh84Z%3DWDOhv3-rEm0VsQbw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFiYsPdbbG3o4cS2qcv-ND2-xcp7xh84Z%3DWDOhv3-rEm0VsQbw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAFiYsPdbbG3o4cS2qcv-ND2-xcp7xh84Z%3DWDOhv3-rEm0VsQbw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAFiYsPdbbG3o4cS2qcv-ND2-xcp7xh84Z%3DWDOhv3-rEm0VsQbw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Adrien Grand

--  
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/CAL6Z4j4Zrk\_00fqtnTTCs%3DumFghj7%2BteGn7MLg7B5gK%2BO77Jow%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j4Zrk_00fqtnTTCs%3DumFghj7%2BteGn7MLg7B5gK%2BO77Jow%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Nimit\_Jain](https://avatars.discourse-cdn.com/v4/letter/n/ac8455/32.png) [@Nimit\_Jain](https://discuss.elastic.co/u/Nimit_Jain)\
**Post date:** [September 11, 2014, 9:45am UTC](https://discuss.elastic.co/t/no-results-in-rest-api/17633/3 "2014-09-11T09:45:08Z")

</div>

Hi  
Could you please help me to connect my server xx.xxx.xx.xxx:12345 with  
elasticsearch rest api in python. I tried alot but still not able to  
established the connection.

On Wednesday, 21 May 2014 09:59:29 UTC+5:30, Pratik Poddar wrote:

> When I am doing es.search using pyelasticsearch I am able to get results,  
> but doing REST API, I do not get results. Please help. Thanks
> 
> searchdoc yields results but rest api gives 0 hits.
> 
> py Elasticsearch settings:  
> bodyquery = {  
> "custom\_score": {  
> "script" : "\_score \*  
> ("+str(1.0+recency)+"\*\*(doc['articleid'].value\*50000.0/"+maxarticleid+"))",  
> "query": {  
> "query\_string": {"query": "Arvind", "fields":  
> ["text", "title^3", "domain"]}  
> }  
> }  
> }
> 
> REST API query:  
> [http://46.137.209.142:9200/article-index/article/\_search?q=Arvind](http://46.137.209.142:9200/article-index/article/_search?q=Arvind)
> 
> My indexing settings are:
> 
> ```
> 'settings': {
> 'analysis': {
> 'analyzer': {
> 'my_ngram_analyzer' : {
> 'tokenizer' : 
> 
> ```
> 
> 'my\_ngram\_tokenizer',  
> 'filter':  
> ['my\_synonym\_filter']  
> }  
> },  
> 'filter': {  
> 'my\_synonym\_filter': {  
> 'type': 'synonym',  
> 'format': 'wordnet',  
> 'synonyms\_path':  
> 'analysis/wn\_s.pl'  
> }  
> },  
> 'tokenizer' : {  
> 'my\_ngram\_tokenizer' : {  
> 'type' : 'nGram',  
> 'min\_gram' : '1',  
> 'max\_gram' : '50'  
> }  
> }  
> }  
> },  
> 'mappings': {  
> 'article': {  
> '\_all': {  
> 'enabled': False  
> },  
> '\_source': {  
> 'compressed': True  
> },  
> 'properties': {  
> 'tags': {  
> 'type': 'string',  
> 'index':  
> 'not\_analyzed'  
> }  
> }  
> }  
> }
> 
> Thanks. Please advise.
> 
> --  
> Pratik Poddar  
> [Pratik Poddar - Nexus Venture Partners | LinkedIn](http://www.linkedin.com/in/pratikpoddar)  
> [http://www.cseblog.com](http://www.cseblog.com)  
> [http://pratikpoddar.wordpress.com/](http://pratikpoddar.wordpress.com/)

--  
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/de380e4f-85c1-4959-b42e-9dde9e520a37%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/de380e4f-85c1-4959-b42e-9dde9e520a37%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, 1:03am UTC](https://discuss.elastic.co/t/no-results-in-rest-api/17633/4 "2017-07-06T01:03:08Z")

</div>


