django-haystack / django-haystack/django-haystack

AutoQuery with spaces causes exception in ElasticSearch?

Open
#950 5 comments 0 reactions 0 assignees View on GitHub

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

# This works:
sqs = sqs.filter(SQ(text=AutoQuery('')))
# This fails with exception ElasticHttpError
sqs = sqs.filter(SQ(text=AutoQuery('  ')))

I noticed if I put in spaces for AutoQuery ElasticSearch throws an exception, is this normal behavior? I couldn't find a solution in the docs or anything so I just have been .strip'ing my strings.

Thanks for any help!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the two AutoQuery examples from the issue, then trace how whitespace-only input is handled in the AutoQuery-to-Elasticsearch query path. Check the resulting exception and existing coverage, if any; done means whitespace input no longer raises unexpectedly or the behavior is documented as intentional.

Written by the indexing model from the issue text.

Assessment

Tech stack
elasticsearch, python
Domain
search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.