Skip to content

Instantly share code, notes, and snippets.

@gregblake
Last active February 18, 2020 16:40
Show Gist options
  • Save gregblake/ac9c2cb7c6053a20e7c43047f3b69909 to your computer and use it in GitHub Desktop.
Save gregblake/ac9c2cb7c6053a20e7c43047f3b69909 to your computer and use it in GitHub Desktop.
ElasticSearch API Endpoint

ElasticSearch API Endpoint

This endpoint will allow clients to search messages within a given conversation.

  1. Request params (room/group): :to_id, :to_type, :query.
  2. Request params (user): :conversation, :query.
  3. If the query parameter is omitted from the request, it should behave exactly like the messages endpoint. Similarly, if the toggle and/or permission are disabled, it'll behave just like the messages endpoint does, without search filtering.
  4. If the necessary parameters are included: return a 200, with a collection of messages that match the query. The response JSON should match the existing format exactly.

Other considerations

  • On the above example, a where clause is used on the messages table, to filter to a particular conversation. If the :to_id and :to_type fields were indexed as well, could we filter by a particular conversation using only ElasticSearch?
  • Ensure the body field is being encrypted in Elastic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment