palantir-foundryfoundry-slatefoundry-phonograph

Select only some columns from a Phonograph2 table in Palantir Foundry Slate


My Foundry Slate app has a query to Phonograph2 using Table Search Service, endpoint Search. The Phonograph table has 50+ columns. The functioning query below would get all columns of rows fulfilling the filter condition object_id = the 2 values

{
  "tableRids": [
    "table_phonograph_rid_12344567"
  ],
  "filter": {
    "type": "terms",
    "terms": {
      "field": "object_id",
      "terms": ["abcd_1234", "efgh_8765"]
    }
  },
  "sort": {
    "year": {
      "order": "asc"
    }
  }
}
}

Instead of getting all the columns, is there a way to collect only 3 columns? I did some research on ElasticSearch query and tried things like adding a "columns": ["object_id", "year","name"] but it did not work. There is no info about this in Foundry documentation. Did anyone solve this problem?

{
  "tableRids": [
    "table_phonograph_rid_12344567"
  ],
  "columns": [
    "object_id", 
    "year",
    "name"
  ],
  "filter": {
    "type": "terms",
    "terms": {
      "field": "object_id",
      "terms": ["abcd_1234", "efgh_8765"]
    }
  },
  "sort": {
    "year": {
      "order": "asc"
    }
  }
}

Solution

  • You can add

    "columnSelector": {"columnWhitelist": ["COL1", ...]}
    

    to the query to select columns