# Hi Wanted Some Help

**URL:** <https://discuss.elastic.co/t/hi-wanted-some-help/309370>\
**Category:** Elasticsearch\
**Created:** [July 12, 2022, 5:44am UTC](https://discuss.elastic.co/t/hi-wanted-some-help/309370 "2022-07-12T05:44:21Z")\
**Posts on this page:** 8\
**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:** [July 12, 2022, 5:44am UTC](https://discuss.elastic.co/t/hi-wanted-some-help/309370/1 "2022-07-12T05:44:21Z")

</div>

The text about **{"took":{"total":1,"successful":1,"skipped":1,"failed":1,"max\_score":1,"hits":1},"timed\_out":{"total":false,"successful":false,"skipped":false,"failed":false,"max\_score":false,"hits":false},"\_shards":{"total":1.0,"successful":1.0,"skipped":0.0,"failed":0.0,"max\_score":null,"hits":null},"hits":{"total":{"value":0,"relation":"eq"},"successful":null,"skipped":null,"failed":null,"max\_score":null,"hits":[]}}**

with python pls help I Have to do it as my project has been paused

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 12, 2022, 5:55am UTC](https://discuss.elastic.co/t/hi-wanted-some-help/309370/2 "2022-07-12T05:55:47Z")

</div>

You will need to provide a lot more context around your setup, version used and exactly what you have done and what is not what you expect in order for anyone to be able to help you.

---

<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:** [July 12, 2022, 8:24am UTC](https://discuss.elastic.co/t/hi-wanted-some-help/309370/3 "2022-07-12T08:24:14Z")

</div>

The thing I want to do is remove the text

---

<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:** [July 12, 2022, 8:25am UTC](https://discuss.elastic.co/t/hi-wanted-some-help/309370/4 "2022-07-12T08:25:22Z")

</div>

I will be pasting the file.

from flask import \*  
from flask\_restful import Api  
from elasticsearch import Elasticsearch  
es = Elasticsearch("[http://localhost:9200](http://localhost:9200)")  
from matches import search  
import pandas  
import spacy  
from spacy.lang.en.stop\_words import STOP\_WORDS as stopwords  
import json  
import numpy as np  
from add import add  
from full\_text import full\_text  
from multimatch import multi\_match  
from matchalles import search\_all

app = Flask( **name** )  
app.secret\_key = 'kingom'  
api = Api(app)

@app.route('/')  
def home():  
return render\_template('home.html')

@app.route('/total' , methods =["GET", "POST"])  
def get\_all():  
search\_all()  
return render\_template('list.html')  
@app.route('/all' , methods =["GET", "POST"])  
def getall():  
return search\_all()

@app.route('/search' , methods =["GET", "POST"])  
def search\_speci():  
global useranswer  
global elastic\_df  
global search\_inpt  
# It Posts Request  
if request.method=="POST":  
# The search input check  
search\_inpt = request.form.get("seab")  
# This is for checking elasticsearch for the search  
response = es.search(index="location" , query={"match":{useranswer:search\_inpt}})  
# Starts for the returning  
elastic\_docs = response["hits"]["hits"]  
# Printing the documents number which are found  
print ("documents returned:", len(response["hits"]["hits"]))  
# Changeing the output to Table then to normal json  
fields = response  
elastic\_df = pandas.DataFrame(fields)  
json\_data = elastic\_df.to\_json()  
# returning the json\_data  
return json\_data  
return render\_template("searchab.html" )

@app.route('/add', methods =["GET", "POST"])  
def add\_docs():  
global about\_add  
# Getting the values of user  
if request.method == "POST":  
about\_add = request.form.get("about")  
where\_add = request.form.get("where")  
# doc for adding  
doc1 = {  
"about": about\_add,  
"where": where\_add  
}  
# code for adding docs  
response = es.index(  
index="location",  
document=doc1,  
id = number  
)  
return about\_add , where\_add  
return render\_template("add.html")

@app.route('/multi' , methods =["GET", "POST"])  
def multi():  
multi\_match()  
return render\_template("multisearch.html")

@app.route('/fulltext' , methods =["GET", "POST"])  
def fulltext():  
# creating stages and appling filters to it  
if request.method=="POST":  
# data = es.search(index="location" , query={"match\_all":{}})  
data = search\_inpt = request.form.get("speci")  
# Defining the dataframe and using it  
df = pandas.DataFrame(data=data)  
stage2 = df.apply(lambda x: len(str(x).split()))  
stage3 = stage2.apply(lambda x: cont\_to\_exp(x))  
stage4 = stage3.apply(lambda x: re.sub(r'[^\w]+', "", x))  
stage5 = stage4.apply(lambda x: ' '.join(x.split()))  
response = es.search(index="location" , query={"match":{"where": stage5}})  
# Changeing the output to Table then to normal json  
fields = response  
elastic\_df = pandas.DataFrame(fields)  
json\_data = elastic\_df.to\_json()  
# returning the json\_data  
return json\_data  
return render\_template("searchwh.html")  
@app.route('/update' , methods =["GET", "POST"])  
def update():  
global about\_update  
# Getting the values of user  
if request.method == "POST":  
about\_update = request.form.get("about")  
where\_update = request.form.get("where")  
user\_id = request.form.get("user\_id")

```
# doc for adding
    doc1 = {
        "about": about_update,
        "where": where_update
    }
# code for adding docs
    response = es.index(
         index="location",
         document=doc1,
         id = user_id
        )
    return "About and Where Updated", doc1
return render_template('update.html')

```

@app.route('/delete' , methods =["GET", "POST"])  
def delete():  
if request.method=="POST":  
search\_inpt = request.form.get("dele")  
dele = es.delete(index = "location",id = search\_inpt)  
search()  
return "The Doc Has Been Successfully Deleted"  
return render\_template('delete.html')  
if **name** == ' **main**':  
app.run(port=5000, debug=True)

{"took":{"total":4,"successful":4,"skipped":4,"failed":4,"max\_score":4,"hits":4},"timed\_out":{"total":false,"successful":false,"skipped":false,"failed":false,"max\_score":false,"hits":false},"\_shards":{"total":1.0,"successful":1.0,"skipped":0.0,"failed":0.0,"max\_score":null,"hits":null},"hits":{"total":{"value":1,"relation":"eq"},"successful":null,"skipped":null,"failed":null,"max\_score":1.0,"hits":[{"\_index":"location","\_id":"1","\_score":1.0,"\_source":{"about":"Om","where":"Bombay"}}]}}

I only want this :[{"\_index":"location","\_id":"1","\_score":1.0,"\_source":{"about":"Om","where":"Bombay"}}]}}

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 12, 2022, 8:29am UTC](https://discuss.elastic.co/t/hi-wanted-some-help/309370/5 "2022-07-12T08:29:03Z")

</div>

You need to explain the problem, your setup/mappings/configuration and what you are looking to achieve and not just paste messages and code if you want anyone here to help. I am not a Python developer and most people will not read through your code and try to guess what you are doing and what is wrong.

---

<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:** [July 12, 2022, 1:21pm UTC](https://discuss.elastic.co/t/hi-wanted-some-help/309370/6 "2022-07-12T13:21:58Z")

</div>

oh ok

well the mapping is  
location index  
fields : about and where

then next we have is the setup the device is Mac  
Elasticsearch version is 8.0.0  
python version 3.10  
And the code is using python and Elasticsearch  
if any changes pls tell

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 12, 2022, 1:28pm UTC](https://discuss.elastic.co/t/hi-wanted-some-help/309370/7 "2022-07-12T13:28:58Z")

</div>

> [@Draco\_King](#):
>
> well the mapping is  
> location index  
> fields : about and where

This is not very useful. Please show the full mappings for the index.

> [@Draco\_King](#):
>
> then next we have is the setup the device is Mac  
> Elasticsearch version is 8.0.0  
> python version 3.10  
> And the code is using python and Elasticsearch  
> if any changes pls tell

This gives us the version you are using. OS and Python version is from my perspective irrelevant. You have still not explained what you are looking to achieve and exactly what is not working. I volunteer my time here and do not have the time nor energy to play question and answer ping-pong, so if you can not take the time to properly describe this I will leave it to someone else to try.

---

<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:** [August 9, 2022, 1:29pm UTC](https://discuss.elastic.co/t/hi-wanted-some-help/309370/8 "2022-08-09T13:29:26Z")

</div>

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