Module Hub Beta

FT.ADD

index_name doc_id score [NOSAVE] FIELDS field1 content1 field2 content2 ...

Add a documet to the index.

Parameters:

  • index: The Fulltext index name. The index must be first created with FT.CREATE
  • docId: The document’s id that will be returned from searches. Note that the same docId cannot be added twice to the same index
  • score: The document’s rank based on the user’s ranking. This must be between 0.0 and 1.0. If you don’t have a score just set it to 1
  • NOSAVE: If set to true, we will not save the actual document in the index and only index it.
  • FIELDS: Following the FIELDS specifier, we are looking for pairs of to be indexed.
    Each field will be scored based on the index spec given in FT.CREATE.
    Passing fields that are not in the index spec will make them be stored as part of the document,
    or ignored if NOSAVE is set

Return Value

Simple String Reply: OK if the the document was added to the index, error otherwise.

Examples

redis> FT.ADD docs doc1 1.0 FIELDS title “war and peace” body “Well, Prince, so Genoa and Lucca are now…”
OK

© 2017 Redis Labs, Inc. All rights reserved.