# How come this simple example doesn't work?

**URL:** <https://discuss.elastic.co/t/how-come-this-simple-example-doesnt-work/13886>\
**Category:** Elasticsearch\
**Created:** [October 9, 2013, 1:00pm UTC](https://discuss.elastic.co/t/how-come-this-simple-example-doesnt-work/13886 "2013-10-09T13:00:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![project2501](https://avatars.discourse-cdn.com/v4/letter/p/41988e/32.png) [@project2501](https://discuss.elastic.co/u/project2501)\
**Post date:** [October 9, 2013, 1:00pm UTC](https://discuss.elastic.co/t/how-come-this-simple-example-doesnt-work/13886/1 "2013-10-09T13:00:26Z")

</div>

from pyes import \*

conn = ES('127.0.0.1:9200')

def main():  
conn.index({'text':'This is great!'},'text-index','doc',1)  
conn.indices.refresh("text-index")  
q1= TextQuery('text','This')  
results = conn.search(q1,index='text-index',typename='doc')  
for r in results:  
print r;

if **name** == ' **main**':  
main()

I'm flummoxed by this.

Any idea?

thanks.

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [October 9, 2013, 6:55pm UTC](https://discuss.elastic.co/t/how-come-this-simple-example-doesnt-work/13886/2 "2013-10-09T18:55:24Z")

</div>

"this" is a stop word. Trying searching for the word "great" or changing  
your analyzer to one that does not have the stop filter.

Cheers,

Ivan

On Wed, Oct 9, 2013 at 6:00 AM, project2501 [darreng5150@gmail.com](mailto:darreng5150@gmail.com) wrote:

> from pyes import \*
> 
> conn = ES('127.0.0.1:9200')
> 
> def main():  
> conn.index({'text':'This is great!'},'text-index','doc',1)  
> conn.indices.refresh("text-index")  
> q1= TextQuery('text','This')  
> results = conn.search(q1,index='text-index',typename='doc')  
> for r in results:  
> print r;
> 
> if **name** == ' **main**':  
> main()
> 
> I'm flummoxed by this.
> 
> Any idea?
> 
> thanks.
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:13am UTC](https://discuss.elastic.co/t/how-come-this-simple-example-doesnt-work/13886/3 "2017-07-06T02:13:11Z")

</div>


