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

datasets/fullquery behaves differently with or without Elasticsearch #1183

Closed
jl-wynen opened this issue Apr 19, 2024 · 2 comments
Closed

datasets/fullquery behaves differently with or without Elasticsearch #1183

jl-wynen opened this issue Apr 19, 2024 · 2 comments
Assignees
Labels
bug Something isn't working hot fix

Comments

@jl-wynen
Copy link
Contributor

Differences between instances with and without Elasitcsearch

There are some differences when querying between SciCat instances that run Elasticsearch vs those that don't run it. I tested with staging.scicat.ess.eu, scicat.ess.eu, and a locally deployed instance (latest GH package) w/o Elasticsearch.

Different behaviour

When querying ESS staging for datasets, it ignores some fields in the query. E.g.

import json
import httpx

response = httpx.get(
        "https://staging.scicat.ess.eu/api/v3/datasets/fullquery",
        params={
            "fields": json.dumps(
                {
                    "proposalId": "123"
                }
            ),
        },
    )
datasets = response.json()
print(len(datasets))
print(datasets[0]['proposalId'])

prints

100
67JH32

In fact, it does not respect proposalId but returns all datasets.

But when running the same query against https://scicat.ess.eu, I get 0 results as this proposal does not exist.

It even ignores unknown fields:

import json
import httpx

response = httpx.get(
        "https://staging.scicat.ess.eu/api/v3/datasets/fullquery",
        params={
            "fields": json.dumps(
                {
                    "asd": ["ess"]
                }
            ),
        },
    )
print(response)
print(len(response.json()))

prints

<Response [200 OK]>
100

Different syntax

import json
import httpx

response = httpx.get(
        "https://staging.scicat.ess.eu/api/v3/datasets/fullquery",
        params={
            "fields": json.dumps(
                {
                    "ownerGroup": "ess"
                }
            ),
        },
    )
print(response)

prints

<Response [400 Bad Request]>

but on production, I get <Response [200 OK]> and a correct list of datasets.

To fix this, I need to change it to

"fields": json.dumps(
    {
        "ownerGroup": ["ess"]
    }
),

on staging.

@Junjiequan Junjiequan self-assigned this Apr 19, 2024
@nitrosx nitrosx added bug Something isn't working hot fix labels Apr 19, 2024
@nitrosx
Copy link
Member

nitrosx commented Apr 19, 2024

They should behave exactly the same with or without ES

@Junjiequan
Copy link
Member

This issue should be fixd by #1228 and #1184.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hot fix
Projects
None yet
Development

No branches or pull requests

3 participants