multiple input parameters in item attributes input for aws personalize batch segment job

0

I followed the below link to generate the input for item affinity receipe https://github.com/aws-samples/amazon-personalize-samples/blob/master/next_steps/core_use_cases/user_segmentation/user_segmentation_example.ipynb

Input

{"itemAttributes":"ITEMS.SKILLS = \"REACT_JS\""}

But I want to provide multiple input for skills HTML, CSS, REACT_JS , and also another attribute TITLE = SDE, EXPERIENCE_RANGE_IN_YEARS_START = 5, EXPERIENCE_RANGE_IN_YEARS_END =10.

How to give multiple key and mutliple values in input itemAttributes in single query ? Is it possible to get output based on multiple parameters

asked a year ago243 views
2 Answers
2

Hi,

Yes, it is possible to provide multiple attributes and their corresponding values as input to the itemAttributes parameter in a single query. You can use the AND logical operator to combine multiple conditions.

Here is an example of how you can provide multiple conditions to the itemAttributes parameter in multiple queries:

{"itemAttributes": "ITEMS.SKILLS = "HTML" AND ITEMS.TITLE = "SDE"}

In this example, we are combining multiple conditions using the logical operators AND . The query will return items that have skills in HTML and have the title "SDE".

You may refer official docs for details if you want.

Hope it helps.

AWS
answered a year ago
  • We tried the recommendation I am getting the below error. Can you suggest what is missing ?

    {"input": { "itemAttributes" : "ITEMS.SKILLS="JAVA" OR ITEMS.SKILLS="ANGULAR_JS""}, "output": {"usersList": []}, "error": "UserError: Error location line 1, index 20 : extraneous input 'OR' expecting {<EOF>, Field}"} {"input": { "itemAttributes" : "(ITEMS.SKILLS="JAVA" OR ITEMS.SKILLS="ANGULAR_JS") AND ITEMS.EXPERIENCE_RANGE_IN_YEARS_START >= 0 AND ITEMS.EXPERIENCE_RANGE_IN_YEARS_END <= 1"}, "output": {"usersList": []}, "error": "UserError: Invalid input symbol: '('"}

  • OR and range is not supported. But you can refer filter function to see if it fits your scenario.

0
Accepted Answer
  1. The expressions for batch segment item-attribute affinity recipe do not support range expressions or logical 'OR'. Currently, the supported querys are as the following example:

{"itemAttributes": "ITEMS.genres = "Comedy" AND ITEMS.genres = "Action""}

{"itemAttributes": "ITEMS.genres = "Comedy""}

{"itemAttributes": "ITEMS.genres = "Horror" AND ITEMS.genres = "Action""}

  1. Batch segment input expressions support only the "=" symbol for equality for string matching

  2. The "OR" operator, it can be splitted into two queries as follows:

{ "itemAttributes" : "ITEMS.genres="Comedy""}

{ "itemAttributes" : "ITEMS.genres="Horror""}

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions