The read-by-id
task reads one or more specific records from a Record Store instance.
The read-by-id
task uses a syntax that is different from the other tasks. The difference is that you specify the record IDs at the end of the command line (i.e., after all the options have been specified).
The syntax for this task is:
recordstore-cmd read-by-id -a RecordStoreInstanceName [-c] [-f FileName] [-g GenId] [-h HostName] [-l true|false] [-p PortNumber] [-x Id] [RecId1 [RecId2 [... RecIdN]
where:
-a (or --instanceName) specifies the name of a Record Store instance. Required.
-c (or --count) prints the record count from the read. Optional.
-f (or --file) specifies the pathname of the file to which the Endeca records are output. The filename extension determines the format of the output file. Valid extensions for the file are
.xml
(for an XML format) and.bin
(for a binary format); the file can also have an additional, optional.gz
extension to create a compressed file. Optional.-g (or --generation) specifies the ID of the generation from which the records are read. If omitted, records from the last-committed generation are read. Optional.
-h (or --host) specifies the host where the CAS Service is running. If the flag is omitted, the default is the value of the
com.endeca.itl.cas.server.host
property incommandline.properties
. If the property is not set, the value then defaults to localhost. Optional.-l (or --isPortSsl) specifies whether to communicate with the service using an HTTPS connection. A value of true uses HTTPS and treats the
com.endeca.itl.cas.server.port
property as an SSL port. A value of false uses HTTP and treatscom.endeca.itl.cas.server.port
as a non-SSL port. Specify false if you enabled redirects from a non-SSL port to an SSL port. Optional.-p (or --port) specifies the port of the CAS Service. If the flag is omitted, the default is the value of the
com.endeca.itl.cas.server.port
property incommandline.properties
. If the property is not set, the value then defaults to 8500. Optional.-x (or --transaction) specifies the active transaction ID to use. If you use this option, you must follow it with a
commit-transaction
task to commit the read operation. If this flag is omitted, the operation is done in auto-commit mode. Optional.recId is the ID of the record to read. The record ID is the value of the record property being used for the
idPropertyName
configuration property. For multiple records, you must specify a space-delimited list of record IDs. If an ID contains a space, enclose the ID within double quotation marks.
Example 28. Example of reading a specific record
Assume that the idPropertyName
configuration in the Record Store instance is set to the Endeca.Web.URL record property. Also assume that you want to read a record that has this value:
<PROP NAME="Endeca.Web.URL"> <PVAL>http://endeca.com/contact.html</PVAL> </PROP>
This means that the string http://endeca.com/contact.html is the ID of that record. You would therefore retrieve that record with this command:
recordstore-cmd read-by-id -a RS1 -f rec.xml http://endeca.com/contact.html
The record will be written in an XML format to the rec.xml
file.