# Hi This is om I wanted some help so pls help me

**URL:** <https://discuss.elastic.co/t/hi-this-is-om-i-wanted-some-help-so-pls-help-me/308417>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [June 29, 2022, 2:32am UTC](https://discuss.elastic.co/t/hi-this-is-om-i-wanted-some-help-so-pls-help-me/308417 "2022-06-29T02:32:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Draco\_King](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/draco_king/32/107254_2.png) [@Draco\_King](https://discuss.elastic.co/u/Draco_King)\
**Post date:** [June 29, 2022, 2:32am UTC](https://discuss.elastic.co/t/hi-this-is-om-i-wanted-some-help-so-pls-help-me/308417/1 "2022-06-29T02:32:35Z")

</div>

This is my python code and wanted help pls help

#!/usr/bin/env python3  
#-_- coding: utf-8 -_-

# import the Elasticsearch low-level client library

from elasticsearch import Elasticsearch

# domain name, or server's IP address, goes in the 'hosts' list

elastic\_client = Elasticsearch("[http://localhost:9200/honraolocation](http://localhost:9200/honraolocation)")

# User makes a request on client side

user\_request = input("Pls type request ")

# Take the user's parameters and put them into a Python

# dictionary structured like an Elasticsearch query:

query\_body = {  
"query": {  
"match": {  
"title": user\_requests  
}  
}  
}

# call the client's search() method, and have it return results

result = elastic\_client.search(query = query\_body)

# see how many "hits" it returned using the len() function

print ("total hits:", len(result["hits"]["hits"]))

'''  
MAKE ANOTHER CALL THAT RETURNS  
MORE THAN 10 HITS BY USING THE 'size' PARAM  
'''  
result = elastic\_client.search(query = query\_body , size=999)  
all\_hits = result['hits']['hits']

# see how many "hits" it returned using the len() function

print ("total hits using 'size' param:", len(result["hits"]["hits"]))

# iterate the nested dictionaries inside the ["hits"]["hits"] list

for num, doc in enumerate(all\_hits):  
print ("DOC ID:", doc["\_id"], "---\>", doc, type(doc), "\n")

```
# Use 'iteritems()` instead of 'items()' if using Python 2
for key, value in doc.items():
    print (key, "-->", value)

# print a few spaces between each doc for readability
print ("\n\n")

```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 29, 2022, 2:53am UTC](https://discuss.elastic.co/t/hi-this-is-om-i-wanted-some-help-so-pls-help-me/308417/2 "2022-06-29T02:53:28Z")

</div>

Please format your code/logs/config using the `</>` button, or markdown style back ticks. It helps to make things easy to read which helps us help you 🙂

---

<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 27, 2022, 2:53am UTC](https://discuss.elastic.co/t/hi-this-is-om-i-wanted-some-help-so-pls-help-me/308417/3 "2022-07-27T02:53:33Z")

</div>

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