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

Adds support for multisearch #30

Merged
merged 5 commits into from
Oct 4, 2024

Conversation

jzonthemtn
Copy link
Collaborator

Description

See #29 - Adds support for multisearch

Issues Resolved

#29

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

To test:

  • Build the docker image and start with docker compose up.
  • Create the ecommerce index: curl -X PUT http://localhost:9200/ecommerce
  • Run an msearch:
curl -s -X GET "http://localhost:9200/_msearch" -H 'Content-Type: application/json' -d'
{ "index": "ecommerce"}
{ "query": { "match_all": {} }, "ext": { "ubi": { "query_id": "11111" } } }
{ "index": "ecommerce"}
{ "query": { "match_all": {} }, "ext": { "ubi": { "query_id": "22222" } } }
'

Now look at the ubi_queries index and you will see two queries that match the query IDs in our msearch request.

curl localhost:9200/ubi_queries/_search

Response:

{
  "took": 2,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 2,
      "relation": "eq"
    },
    "max_score": 1,
    "hits": [
      {
        "_index": "ubi_queries",
        "_id": "Sd6JU5IBPUzlZ11s4psz",
        "_score": 1,
        "_source": {
          "query_response_id": "b226e3db-0797-44bc-a349-fc4722881872",
          "user_query": "",
          "query_id": "22222",
          "query_response_object_ids": [],
          "query": "{\"query\":{\"match_all\":{\"boost\":1.0}},\"ext\":{\"query_id\":\"22222\",\"user_query\":null,\"client_id\":null,\"object_id_field\":null,\"query_attributes\":{}}}",
          "query_attributes": {},
          "client_id": "",
          "timestamp": 1727978398255
        }
      },
      {
        "_index": "ubi_queries",
        "_id": "St6JU5IBPUzlZ11s4psz",
        "_score": 1,
        "_source": {
          "query_response_id": "f73c8b07-34ec-43d6-8554-c62372af3c9f",
          "user_query": "",
          "query_id": "11111",
          "query_response_object_ids": [],
          "query": "{\"query\":{\"match_all\":{\"boost\":1.0}},\"ext\":{\"query_id\":\"11111\",\"user_query\":null,\"client_id\":null,\"object_id_field\":null,\"query_attributes\":{}}}",
          "query_attributes": {},
          "client_id": "",
          "timestamp": 1727978398255
        }
      }
    ]
  }
}

@jzonthemtn jzonthemtn added this to the 2.17.0 milestone Oct 3, 2024
@jzonthemtn jzonthemtn marked this pull request as draft October 3, 2024 18:08
Copy link
Collaborator

@epugh epugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. a Nit or two but otherwise looks great.

@@ -1,5 +1,7 @@
FROM opensearchproject/opensearch:2.14.0
FROM opensearchstaging/opensearch:3.0.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this kind of the pattern that plugins use?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it seems to be.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want this in....


// TODO: Ignore the UBI in ext.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this mean? I'm fine with the TODO, but would love a bit more detail about what this means ;-)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thought was to not log the ubi part of the query to save space. I will take this out and write an issue.

@jzonthemtn jzonthemtn marked this pull request as ready for review October 3, 2024 18:13
@jzonthemtn jzonthemtn merged commit 1e92b6d into opensearch-project:main Oct 4, 2024
11 checks passed
@jzonthemtn jzonthemtn deleted the 29-multisearch branch October 4, 2024 14:58
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

Successfully merging this pull request may close these issues.

2 participants