Hello everyone. I am writing with the following pr...
# community-help
g
Hello everyone. I am writing with the following problem I am facing. I have created a field "test" which is an object type. In it I write an object with the following structure:
Copy code
{1: {id:1, price: 10},2: {id:2, price: 15},3: {id:3, price: 20}}
and when I run a multisearch request:
Copy code
{
  "searches": [
    {
      "q": "adidas",
      "per_page": 16,
      "page": 1,
      "case_sensitive": false,
      "collection": "products_4878",
      "filter_by": "test.2.id:=2",
      "group_by": "item_id",
      "group_limit": 1,
      "sort_by": "test.2.price:asc",
      "query_by": "name",
      "include_fields": "id,item_id,name"
    }
  ]
}
there is no problem, but if i use "test.10" got this error "Could not find a filter field named
customer_group.10.id
in the schema." for "filter_by", this error "Could not find a facet field named
customer_group.10.price
in the schema." for "facet_by" and this error "Could not find a field named
customer_group.10.id
in the schema." for "group_by". I used version 27.1. How can i fih that problem? Option for dinamicly update of schema is not OK. there is option for many create and delete records for test with different id's
k
Do you also have another field called
customer_group
in your schema? It will be useful if you can post a fully reproducible example: 1. Your collection schema 2. One sample doc 3. The query which fails
g
There is schema:
Copy code
{
  "name": "test_collection",
  "enable_nested_fields": true,
  "fields": [
    {
      "name": "name",
      "type": "string"
    },
    {
      "name": "customer_group",
      "type": "object",
      "facet": true,
      "optional": true
    }
  ]
}
2 documents:
Copy code
[
{
    "id": "1",
    "name": "Stark Industries",
    "customer_group": {
        "1": {
            "id": 1,
            "price": 10
        },
        "2": {
            "id": 2,
            "price": 15
        },
        "3": {
            "id": 3,
            "price": 20
        }
    }
},
{
    "id": "2",
    "name": "Stark Industries 2",
    "customer_group": {
        "3": {
            "id": 3,
            "price": 10
        },
        "4": {
            "id": 4,
            "price": 15
        },
        "5": {
            "id": 5,
            "price": 20
        }
    }
}
]
And multysearch query with success response:
Copy code
{
  "searches": [
    {
      "collection": "test_collection",
      "q": "*",
      "filter_by": "customer_group.3.id:=3"
    }
  ]
}
and with error:
Copy code
{
  "searches": [
    {
      "collection": "test_collection",
      "q": "*",
      "filter_by": "customer_group.6.id:=6"
    }
  ]
}
that example is similar for filter_by, group_by, facet_by
k
Got it. So since that field doesn't exist yet we throw an error. I understand that this doesn't quite work for dynamic fields of an object. We are going to fix this.
g
great. thanks.
can you return me a message when fixed?
👍 1
that schma has some problem:
Copy code
{
  "name": "companies",
  "fields": [
    {
      "name": ".*_facet",
      "type": "auto",
      "facet": true
    }
  ]
}
if i have 1_facet, 2_facet, but group by 3_facet there is exception
Hi @Kishore Nallan, any developments with this issue? Or possibly when can we expect a fix?
k
This is on my plate for this week. I will post an update when we have a RC build with the fix.
g
Excellent news. Thank you very much
Hi @Kishore Nallan there is fix for bug? thanks and sorry
k
Not fully done yet. It works for query_by, and facet_by but not yet for group_by or filter_by. I will post an update when all 4 are done.
We might only support query_by, facet_by and filter_by for now: group_by maybe later. We've to check that.
g
@Kishore Nallan group_by is most important to me unfortunately. Will there be any development with him?
k
What do you expect to happen when group by field is not found in any docs?
g
I have field item_id, and object test with that structure: {1: {id:1, price: 10},2: {id:2, price: 15},3: {id:3, price: 20}}. when group by item_id, test.1 if no records with test.1 then group only by item_id. if i use onli test.1 for group and no records with that match, there is no grouped documents 🙂
k
Ok will check on this
g
very thanks 🙂
for other 3 witch tag can test?
k
Don't have a build yet, will share once filter by is done.
g
ok, thanks
k
Please check
28.0.rc22
-- we have added a
validate_field_names
boolean parameter which you can use to control the field validation behavior. This is now implemented for group by and filter by as well.
🙌 1