Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elasticsearch haystack fails search #8877

Open
nicokant opened this issue Mar 2, 2022 · 0 comments
Open

Elasticsearch haystack fails search #8877

nicokant opened this issue Mar 2, 2022 · 0 comments

Comments

@nicokant
Copy link
Contributor

nicokant commented Mar 2, 2022

Expected Behavior

Searching for "members" should find the default group "Registered Members"

Actual Behavior

Nothing is found, the UI breaks
FireShot Capture 106 - Cerca - localhost - localhost

Steps to Reproduce the Problem

  1. create a geonode-project from the branch 3.2
  2. add elasticsearch service to the docker-compose.yml
elasticsearch:
  image: elasticsearch:2.4.1
  restart: unless-stopped
  container_name: elasticsearch4${COMPOSE_PROJECT_NAME}
  stdin_open: true
  1. enable search with haystack inside .env
HAYSTACK_SEARCH=True
HAYSTACK_ENGINE_URL=http://elasticsearch:9200/
  1. start the docker docker-compose up -d --build
  2. search for "members"

Specifications

  • GeoNode version: 3.2
  • Installation method: geonode-project
  • Platform: Linux
  • Additional details:

The search uses a REST API http://localhost/api/base/search/?abstract__icontains=members&f_method=or&limit=5&offset=0&purpose__icontains=members&q=members which answers with a 404 error with the following json body

{
"error_message": "Sorry, no results on that page.",
"traceback": "Traceback (most recent call last):\n\n  File \"/usr/src/geonode/geonode/api/resourcebase_api.py\", line 493, in get_search\n    page = paginator.page(\n\n  File \"/usr/local/lib/python3.8/site-packages/django/core/paginator.py\", line 70, in page\n    number = self.validate_number(number)\n\n  File \"/usr/local/lib/python3.8/site-packages/django/core/paginator.py\", line 47, in validate_number\n    raise EmptyPage(_('That page number is less than 1'))\n\ndjango.core.paginator.EmptyPage: Quel numero di pagina è minore di 1\n\n\nDuring handling of the above exception, another exception occurred:\n\n\nTraceback (most recent call last):\n\n  File \"/usr/local/lib/python3.8/site-packages/tastypie/resources.py\", line 228, in wrapper\n    response = callback(request, *args, **kwargs)\n\n  File \"/usr/src/geonode/geonode/api/resourcebase_api.py\", line 497, in get_search\n    raise Http404(\"Sorry, no results on that page.\")\n\ndjango.http.response.Http404: Sorry, no results on that page.\n"
}

Using the MITM Proxy I was able to inspect the request made by geonode to elasticsearch, it returns the following body which has the expected hit:

{
"took":118,
"timed_out":false,
"_shards": {"total":5,"successful":5,"failed":0},
"hits":{"total":1,"max_score":null,"hits":[{"_index":"haystack","_type":"modelresult","_id":"1","_score":null,"_source":{"id": 1, "django_ct": "groups.groupprofile", "django_id": "1", "text": "\nRegistered Members\n\n[]", "title": "Registered Members", "title_sortable": "registered members", "description": "", "type": "group", "type_exact": "group", "json": "{\"_type\": \"group\", \"title\": \"Registered Members\", \"description\": \"\", \"keywords\": [], \"thumb\": \"/static/static/img/contact.png\", \"detail\": null}"},"sort":[-9223372036854775808]}]},
"aggregations":{"owner":{"meta":{"_type":"terms"},"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[]},"type_exact":{"meta":{"_type":"terms"},"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[{"key":"group","doc_count":1}]},"category_exact":{"meta":{"_type":"terms"},"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[]},"keywords_exact":{"meta":{"_type":"terms"},"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[]},"subtype_exact":{"meta":{"_type":"terms"},"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[]},"regions_exact":{"meta":{"_type":"terms"},"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[]}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant