Search for a memory

Introduced 2.12

This API retrieves a conversational memory for conversational search. Use this command to search for memories.

When the Security plugin is enabled, all memories exist in a private security mode. Only the user who created a memory can interact with that memory and its messages.

Path and HTTP methods

  1. GET /_plugins/_ml/memory/_search
  2. POST /_plugins/_ml/memory/_search

Example request: Searching for all memories

  1. POST /_plugins/_ml/memory/_search
  2. {
  3. "query": {
  4. "match_all": {}
  5. },
  6. "size": 1000
  7. }

copy

Example request: Searching for a memory by name

  1. POST /_plugins/_ml/memory/_search
  2. {
  3. "query": {
  4. "term": {
  5. "name": {
  6. "value": "conversation"
  7. }
  8. }
  9. }
  10. }

copy

Example response

  1. {
  2. "took": 1,
  3. "timed_out": false,
  4. "_shards": {
  5. "total": 1,
  6. "successful": 1,
  7. "skipped": 0,
  8. "failed": 0
  9. },
  10. "hits": {
  11. "total": {
  12. "value": 3,
  13. "relation": "eq"
  14. },
  15. "max_score": 0.2195382,
  16. "hits": [
  17. {
  18. "_index": ".plugins-ml-memory-meta",
  19. "_id": "znCqcI0BfUsSoeNTntd7",
  20. "_version": 3,
  21. "_seq_no": 39,
  22. "_primary_term": 1,
  23. "_score": 0.2195382,
  24. "_source": {
  25. "updated_time": "2024-02-03T20:36:10.252213029Z",
  26. "create_time": "2024-02-03T20:30:46.395829411Z",
  27. "application_type": null,
  28. "name": "Conversation about NYC population",
  29. "user": "admin"
  30. }
  31. },
  32. {
  33. "_index": ".plugins-ml-memory-meta",
  34. "_id": "iXC4bI0BfUsSoeNTjS30",
  35. "_version": 4,
  36. "_seq_no": 11,
  37. "_primary_term": 1,
  38. "_score": 0.20763937,
  39. "_source": {
  40. "updated_time": "2024-02-03T02:59:39.862347093Z",
  41. "create_time": "2024-02-03T02:07:30.804554275Z",
  42. "application_type": null,
  43. "name": "Test conversation for RAG pipeline",
  44. "user": "admin"
  45. }
  46. },
  47. {
  48. "_index": ".plugins-ml-memory-meta",
  49. "_id": "gW8Aa40BfUsSoeNTvOKI",
  50. "_version": 4,
  51. "_seq_no": 6,
  52. "_primary_term": 1,
  53. "_score": 0.19754036,
  54. "_source": {
  55. "updated_time": "2024-02-02T19:01:32.121444968Z",
  56. "create_time": "2024-02-02T18:07:06.887061463Z",
  57. "application_type": null,
  58. "name": "Conversation for a RAG pipeline",
  59. "user": "admin"
  60. }
  61. }
  62. ]
  63. }
  64. }

Response fields

The following table lists all response fields.

FieldData typeDescription
memory_idStringThe memory ID.
create_timeStringThe time at which the memory was created.
updated_timeStringThe time at which the memory was last updated.
nameStringThe memory name.
userStringThe username of the user who created the memory.