Search code examples
vespa

Get only specific field from get_data feature of pyvespa


I am using pyvespa functionalities in my project. To get data from document, I am using get_data function supported by pyvespa. Is there a way to get only specific fields from this function and not all the fields?

Thanks.


Solution

  • get_data will return the entire document in the response. You can access a specific field from this response but not limit the response to particular fields. For example, to access a text field:

    response = app.get_data(schema="sentence", data_id=0)
    response.json["fields"]["text"]