Marri Shiva
08/20/2025, 8:51 AMmulti_search
endpoint) and noticed that the exclude_fields
parameter does not seem to work as expected.
For example, here’s my search payload:
{
"searches": [
{
"collection": "qa-products",
"q": "*",
"query_by": "pName,pAlias,pBrand,CardType,sName",
"exclude_fields": "pPrice",
"facet_by": "CardType,pBrand,sID",
"page": 1,
"per_page": 250,
"sort_by": "AttribRank:asc,pGroup:asc,pGroupItemDate:desc",
"filter_by": "(sID:=[0cppGlK500aS1000000])&&(pActive:=[true])&&(pVisibility:=[true])&&(SAC_Activated:=[true])&&(pAttribStatus:=[Active])"
}
]
}
Even though I’ve specified exclude_fields: "pPrice"
, the pPrice
field still appears in the hits
response.
When I switch to include_fields
, it works correctly and hides the fields I don’t want.
Is this a known issue or limitation with exclude_fields
(especially in multi-search)?
If so, is there a recommended workaround or plan to fix it in future releases?Harpreet Sangar
08/21/2025, 10:31 AM"collection": "qa-products",
"q": "*",
"exclude_fields": "pPrice"
query first?Marri Shiva
08/21/2025, 11:27 AMpPrice
in the response
{
"searches": [
{
"collection": "qa-products",
"q": "*",
"exclude_fields": "pPrice"
}
]
}
Harpreet Sangar
08/21/2025, 11:45 AMHarpreet Sangar
08/21/2025, 11:47 AMpPrice
field in it.Marri Shiva
08/21/2025, 11:54 AMsample document
{
"document": {
"AttribName": "Holi mela",
"AttribRank": 39,
"AttribType": "Tag",
"CardType": "Holi mela",
"ItemDisplay": "yes",
"SAC_Activated": "true",
"SCID": "16826666263922nDS200000M",
"ShopCatalogueID": "16826666263922nDS200000M",
"SlotIDs": null,
"Src": "16826666263922nDS200000M",
"iID": "",
"id": "16826666264642nDS300000M-Holi-mela",
"invCsq": "",
"invMsq": "",
"isMasterCatalogueItem": "false",
"pActive": "true",
"pAisleInfo": "",
"pAlias": "Chair for the camp",
"pAttribStatus": "Active",
"pBrand": "",
"pCDetails": null,
"pCategory": "Outdoor Recreation",
"pCost": 0,
"pDID": "",
"pDepartment": "Sports and Outdoors",
"pDeposits": {},
"pDescription": "<p><span style=\"background-color: rgb(102, 102, 0);\">This is a </span><span style=\"background-color: rgb(153, 51, 255);\">temporary </span>text</p><p><br></p><p>Dvd dvd f<span style=\"color: rgb(240, 102, 102);\">bfbvfvdvf</span></p><p><br></p><p><br></p><p><br></p>",
"pGroupItemDate": "2024-01-09T14:42:38.717Z",
"pID": "16826666264642nDS300000M",
"pIsInventoried": "true",
"pIsInventoryOOS": "false",
"pManufacturerName": "None",
"pManufacturerUPC": "None",
"pMsr": "7",
"pName": "Camping Chair",
"pPrice": 450.99,
"pRowState": "Published",
"pSCategory": "Camping",
"pScRowState": "Published",
"pStatus": "Available",
"pStickers": [],
"pStoreItemID": "None",
"pSubsc": "true",
"pSubscOrders": "false",
"pTImg": "<https://s3.amazonaws.com/lhmasterimages/ItemCatalogue/3b32b351a6fe394fa280742e923723d784ff5a4fb7bcd087b8>",
"pTags": [],
"pTax": "zerotax table",
"pTemplate": null,
"pUQMflag": "false",
"pUniqueLHID": "None",
"pUnit": 1,
"pVWeight": "false",
"pVariantCount": 0,
"pVisibility": "true",
"published": "true",
"sID": "00awrdt50bUS1000000",
"sName": "GrowMore",
"sSubscription": ""
},
"highlight": {},
"highlights": [],
"text_match": 100,
"text_match_info": {
"best_field_score": "0",
"best_field_weight": 12,
"fields_matched": 4,
"num_tokens_dropped": 1,
"score": "100",
"tokens_matched": 0,
"typo_prefix_score": 255
}
}
Marri Shiva
08/21/2025, 11:56 AM{
"facet": true,
"index": true,
"infix": false,
"locale": "",
"name": "pPrice",
"optional": true,
"sort": true,
"stem": false,
"stem_dictionary": "",
"store": true,
"type": "float"
}
Harpreet Sangar
08/21/2025, 12:03 PM{
"searches": [
{
"collection": "qa-products",
"q": "*",
"exclude_fields": "pPrice"
}
]
}
still includes pPrice
in the response? If yes, please share the steps in this format https://gist.github.com/jasonbosco/7c3432713216c378472f13e72246f46bHarpreet Sangar
08/21/2025, 12:03 PMMarri Shiva
08/25/2025, 6:46 AMHarpreet Sangar
08/25/2025, 6:49 AMWhen I used a scoped search key, I was able to get pPrice in the response even though I sent exclude_fieldsIt must be because exclude_fields is already defined in the key.
Marri Shiva
08/25/2025, 6:50 AMMarri Shiva
08/25/2025, 6:52 AMexclude_fields
/ include_fields
, but those apply globally to the entire query.
Is there a way in Typesense to exclude fields conditionally based on a field value (like shopId
) directly at the search/query level?Harpreet Sangar
08/25/2025, 6:54 AMshopId
. It would offer better flexibility for your use case.Marri Shiva
08/25/2025, 7:00 AMshopId
makes sense for shop-specific searches.
But in our case, we also have a global search feature that returns items from multiple shops in a single query. In that case, we can’t restrict the key to a single shopId
, since we need results from all shops together.
That’s why we were wondering if there’s any way in Typesense to conditionally exclude fields based on shopId
within the same global search query.Harpreet Sangar
08/25/2025, 7:34 AMBut in our case, we also have a global search feature that returns items from multiple shops in a single query. In that case, we can’t restrict the key to a single shopId, since we need results from all shops together.You can have per shop search key and still get unified search result using Union feature.
Harpreet Sangar
08/25/2025, 7:34 AMHarpreet Sangar
08/25/2025, 7:35 AMThat’s why we were wondering if there’s any way in Typesense to conditionally exclude fields based on shopId within the same global search query.This is not possible.