pgsync icon indicating copy to clipboard operation
pgsync copied to clipboard

Invalid parameter contexts in Completion suggest

Open abhishek72850 opened this issue 10 months ago • 8 comments

I was trying to add context to the completion field like this:

"title__suggest": {
      "type": "completion",
      "contexts": [
          {
              "name": "user",
              "type": "category",
              "path": "user_id"
          }
      ]
  }

But got this error, is contexts not supported in pgsync?

     return self.main(*args, **kwargs)

   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1078, in main

     rv = self.invoke(ctx)

   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke

     return ctx.invoke(self.callback, **ctx.params)

   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 783, in invoke

     return __callback(*args, **kwargs)

   File "/usr/local/lib/python3.10/site-packages/pgsync/sync.py", line 1509, in main

     sync: Sync = Sync(

   File "/usr/local/lib/python3.10/site-packages/pgsync/singleton.py", line 36, in __call__

     cls._instances[key] = super(Singleton, cls).__call__(

   File "/usr/local/lib/python3.10/site-packages/pgsync/sync.py", line 107, in __init__

     self.create_setting()

   File "/usr/local/lib/python3.10/site-packages/pgsync/sync.py", line 255, in create_setting

     self.search_client._create_setting(

   File "/usr/local/lib/python3.10/site-packages/pgsync/search_client.py", line 284, in _create_setting

     mapping = self._build_mapping(tree, routing)

   File "/usr/local/lib/python3.10/site-packages/pgsync/search_client.py", line 331, in _build_mapping

     raise RuntimeError(

 RuntimeError: Invalid Elasticsearch mapping parameter contexts

abhishek72850 avatar Feb 19 '25 14:02 abhishek72850

This also doesn't work:

"title__suggest": {
      "type": "completion",
      "fields": {
          "contexts": [
              {
                  "name": "user",
                  "type": "category",
                  "path": "user_id"
              }
          ]
      }
  }

abhishek72850 avatar Feb 19 '25 14:02 abhishek72850

Hi any update on this?

abhishek72850 avatar Feb 28 '25 14:02 abhishek72850

Hi @toluaina , not hurrying anything, just want to understand if this is known limitation and whether this could be resolved soon or not? if not then we have to make some customization to support this behaviour, thanks.

abhishek72850 avatar Mar 06 '25 06:03 abhishek72850

  • can you please provide the full mapping or your schema.json
  • Also what version of ES or OS are you using?
  • This is the current list of known mapping.

toluaina avatar Mar 12 '25 15:03 toluaina

  • Full Schema:
[
    {
        "database": "my_db",
        "index": "search-index",
        "nodes": {
            "table": "services",
            "schema": "public",
            "transform": {
                "mapping": {
                    "created_at": {
                        "type": "date"
                    },
                    "created_by": {
                        "type": "long"
                    },
                    "deleted_by": {
                        "type": "long"
                    },
                    "description": {
                        "type": "text"
                    },
                    "email": {
                        "type": "keyword"
                    },
                    "end_date": {
                        "type": "date"
                    },
                    "experience_years": {
                        "type": "float"
                    },
                    "id": {
                        "type": "long"
                    },
                    "is_deleted": {
                        "type": "boolean"
                    },
                    "job_location_type": {
                        "type": "keyword"
                    },
                    "service_category": {
                        "type": "keyword"
                    },
                    "status": {
                        "type": "keyword"
                    },
                    "title": {
                        "type": "text"
                    },
                    "updated_at": {
                        "type": "date"
                    },
                    "updated_by": {
                        "type": "long"
                    },
                    "user_id": {
                        "type": "long"
                    },
                    "rating": {
                        "type": "float"
                    },
                    "title__suggest": {
                        "type": "completion"
                    },
                    "description__suggest": {
                        "type": "completion"
                    },
                    "job_location_type__suggest": {
                        "type": "completion"
                    },
                    "service_category__suggest": {
                        "type": "completion"
                    },
                    "users_name__suggest": {
                        "type": "completion"
                    },
                    "company_type__suggest": {
                        "type": "completion"
                    },
                    "company_name__suggest": {
                        "type": "completion"
                    },
                    "designation__suggest": {
                        "type": "completion"
                    },
                    "service_tags__suggest": {
                        "type": "completion"
                    },
                    "service_skills__suggest": {
                        "type": "completion"
                    }
                }
            }
        }
    }
]

cc @toluaina

abhishek72850 avatar Mar 15 '25 11:03 abhishek72850

hi @toluaina just following up here

abhishek72850 avatar Mar 28 '25 16:03 abhishek72850

hi @toluaina any update here?

abhishek72850 avatar Apr 21 '25 18:04 abhishek72850

hi @toluaina any update here?

abhishek72850 avatar Jun 30 '25 16:06 abhishek72850