This message was deleted.
# community-help
s
This message was deleted.
k
👋 I remember fixing a similar issue on the 0.25 RC builds. Would you be able to quickly try locally against a docker build of 0.25 RC?
For e.g. on
typesense/typesense:0.25.0.rc48
build.
Also the schema looks a bit weird (first screenshot).
fields
should be part of the collection schema but in the PHP code it seems to be part of
regularPrice
object field.
z
Thank you for your response I appreciate it. I am trying to have a nested object for regularPrice, and inside the object should be any property (eg. AUD, NZD, USD etc.) that has a float value so when returned on the document it should have something like this
Copy code
{
  // other properties
  "regularPrice": {
    "AUD": 20.20,
    "NZD": 20.00,
    "USD": 12.00,
  }
}
k
You can just define a regularPrice field of type object. The types of inner child fields will be auto detected.
z
yes I tried that however, if document 1 sets regularPrice.AUD to int64 (because of typesense treating a whole number as int64 even if the type of php is float) then all other document's regularPrice.AUD should be int64. now the problem I have is that some documents are floats and this will error out when importing those documents
that is why I explicitly define it to have floats and hoping that would force it
k
Ok can you try with field name as
regularPrice.*
And type as
float
z
ok I'll try
thanks
hello again, so I tried this and it now affects other objects
k
This is probably fixed in recent 0.25 RC builds (https://github.com/typesense/typesense/issues/973).
z
this was fixed on 0.25.0.rc24, and our version is rc27
k
Can you please post a smaller code snippet that directly reproduces the issue so I can try it out and find out where it's exactly going wrong? The gist should contain: 1. Creating a collection with a schema with 1 or 2 fileds 2. A sample document ingested that causes the error With the above it will be easy for me to reproduce what's happening. You can use curl as well, see an example here: https://gist.github.com/kishorenc/865511899735ab23d82b29d8592751c5
z
hello, here's the command I tried. the results are on the screenshot. thanks
Copy code
export TYPESENSE_API_KEY=REDACTED
export TYPESENSE_HOST=REDACTED
export TYPESENSE_COLLECTION_NAME=test_products

curl -k "${TYPESENSE_HOST}/collections" -X POST -H "Content-Type: application/json" \
      -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{
        "name": "test_products",      
        "fields": [              
          {"name": "regularPrice.*", "type": "float"}, 
          {"name": "title", "type": "string"}
        ],
        "enable_nested_fields": true       
      }'

curl "${TYPESENSE_HOST}/collections/${TYPESENSE_COLLECTION_NAME}/documents" -X POST \
        -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{"title": "Product 1", "regularPrice": { "AUD": 1, "NZD": 2.2 }}'

curl "${TYPESENSE_HOST}/collections/${TYPESENSE_COLLECTION_NAME}/documents" -X POST \
        -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{"title": "Product 1", "regularPrice": { "AUD": 1.0, "NZD": 2.2 }}'
k
ty will get back to you
z
thanks for looking into this. I really appreciate it
Hello, I was wondering if you have replicated the issue?
k
Yes I was able to reproduce. Will be looking to fix it in the next few days.
🙇 1
I've a fix for this. Do you use Typesense Cloud?
z
yes
k
Please ping me the cluster ID and I will schedule an upgrade or you can also verify the fix locally first?
z
can we do the upgrade ourselves via the cluster configuration?
k
Yes look for
0.25.0.rc54
version
z
Thanks a lot, I really appreciate your help. I'll let you know how it go
👍 1
it worked! you're a legend! thanks.
k
Glad to hear!