3

I am unable to find any documentation regarding how do I implement Simple Query String Query in my Django Elasticsearch-dsl

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html

Can someone guide me through it?

This is my search function.

def search(q_string):
client = Elasticsearch(
    [
        'elasticsearch'
    ]
)
s = Search(using=client).query(SimpleQueryString(q_string))

Above code is showing me paring error.

1 Answer 1

1

Follow the same structure as the json document - whatever keys in the object will become kwargs, so:

SimpleQueryString(query="QUERY", fields=[...], default_operator='and')

also please don't create a new instance of Elasticsearch for every search, use a global instance and reuse it.

Hope this helps!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.