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

[Joins] Error on indexing reference field with enabled nested fields #1664

Open
mitallast opened this issue Apr 11, 2024 · 0 comments
Open

Comments

@mitallast
Copy link

Description

Error while indexing document with reference field as nested.

Steps to reproduce

  1. Create origin collection
curl -sv -X POST --location "http://localhost:8108/collections" \
    -H "x-typesense-api-key: testapikey" \
    -H "Content-Type: application/json" \
    -d '{
          "name": "foo",
          "fields": [
            {"name": "title", "type": "string"}
          ]
        }'
        
< HTTP/1.1 201 Created
< Connection: keep-alive
< access-control-allow-origin: *
< content-type: application/json; charset=utf-8
< transfer-encoding: chunked
< 
* Connection #0 to host localhost left intact
{"created_at":1712826694,"default_sorting_field":"","enable_nested_fields":false,"fields":[{"facet":false,"index":true,"infix":false,"locale":"","name":"title","optional":false,"sort":false,"stem":false,"type":"string"}],"name":"foo","num_documents":0,"symbols_to_index":[],"token_separators":[]}
  1. Create collection with reference field as nested
curl -sv -X POST --location "http://localhost:8108/collections" \
    -H "x-typesense-api-key: testapikey" \
    -H "Content-Type: application/json" \
    -d '{
          "name": "bar",
          "fields": [
            {
              "name": "foo.foo_id",
              "type": "string",
              "reference": "foo.id"
            },
            {
              "name": "title",
              "type": "string"
            }
          ],
          "enable_nested_fields": true
        }'
< HTTP/1.1 201 Created
< Connection: keep-alive
< access-control-allow-origin: *
< content-type: application/json; charset=utf-8
< transfer-encoding: chunked
< 
* Connection #0 to host localhost left intact
{"created_at":1712826804,"default_sorting_field":"","enable_nested_fields":true,"fields":[{"facet":false,"index":true,"infix":false,"locale":"","name":"foo.foo_id","optional":false,"reference":"foo.id","sort":false,"stem":false,"type":"string"},{"facet":false,"index":true,"infix":false,"locale":"","name":"title","optional":false,"sort":false,"stem":false,"type":"string"}],"name":"bar","num_documents":0,"symbols_to_index":[],"token_separators":[]}
  1. Add origin document
curl -sv -X POST --location "http://localhost:8108/collections/foo/documents" \
    -H "x-Typesense-Api-Key: testapikey" \
    -H "Content-Type: application/json" \
    -d '{
          "id": "123",
          "title": "hello"
        }'
< HTTP/1.1 201 Created
< Connection: keep-alive
< access-control-allow-origin: *
< content-type: application/json; charset=utf-8
< transfer-encoding: chunked
< 
* Connection #0 to host localhost left intact
{"id":"123","title":"hello"}
  1. Try to add document with reference to origin existing document
curl -sv -X POST --location "http://localhost:8108/collections/bar/documents" \
    -H "x-Typesense-Api-Key: testapikey" \
    -H "Content-Type: application/json" \
    -d '{
          "id": "124",
          "title": "hello",
          "foo": {
            "foo_id": "123"
          }
        }'
< HTTP/1.1 404 Not Found
< Connection: keep-alive
< access-control-allow-origin: *
< content-type: application/json; charset=utf-8
< transfer-encoding: chunked
< 
* Connection #0 to host localhost left intact
{"message":"Field `foo.foo_id_sequence_id` not found."}

Expected Behavior

Success on indexing document with reference field as nested

Actual Behavior

Error with unexpected _foo.foo_id_sequence_id field

Metadata

Typesense Version: 26.0, running in docker
OS: ubuntu 22.04

@mitallast mitallast changed the title Error on indexing reference field with enabled nested fields [Joins] Error on indexing reference field with enabled nested fields Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants