django-haystack / django-haystack/django-haystack
How to use JSON queries with Haystack using Elasticsearch?
Open
Nobody has claimed this yet.
needs review
- Dominant language
- Python
- Stars
- 3.7k
- Forks
- 1.3k
- Avg merge
- 3h 18m
- Merged PRs (30d)
- 3
Description
I would like to use following JSON query with Haystack, but cannot find how to use JSON queries instead of QuerySet (as it seems there is no way to do this in QuerySet).
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"term": {
"django_ct": "repositories.repository"
}
},
{
"term": {
"status": 1
}
},
{
"term": {
"is_private": false
}
},
{
"term": {
"is_library": false
}
}
]
}
},
"query": {
"function_score": {
"query": {
"bool": {
"should": [
{
"match": {
"name": {
"query": "hipache"
}
}
},
{
"custom_boost_factor": {
"boost_factor": 0.005,
"query": {
"multi_match": {
"fields": [
"name_auto^3",
"name_auto.partial^2",
"name_auto.partial_back",
"name_auto.partial_middle"
],
"query": "hipache"
}
}
}
}
]
}
},
"script_score": {
"script": "_score * (1 + 10.0*log(1 + doc['pull_count'].value))"
}
}
}
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing Haystack's QuerySet and Elasticsearch integration to determine whether the JSON query shown can be represented or passed through. Check the existing issue discussion for the intended API and define done as a documented, tested way to use this query, or a clear statement that it is unsupported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elasticsearch, python
- Domain
- backend, search
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100