Create a Custom Date/Time Parser
- how-to
Create a custom date/time parser with the Couchbase Server Web Console to tell the Search Service how to process a new date/time format.
If you store date data in a format other than RFC-3339 (ISO-8601), then you need to create a date/time parser.
Prerequisites
-
You have the Search Service enabled on a node in your database. For more information about how to deploy a new node and Services on your database, see Manage Nodes and Clusters.
-
You have created an index. For more information, see Create a Basic Search Index with the Web Console.
-
You have logged in to the Couchbase Server Web Console.
Procedure
To create a custom date/time parser with the Couchbase Server Web Console:
-
Go to Search.
-
Click the Search index where you want to create a custom date/time parser.
-
Click Edit.
-
Expand
. -
Click Add Date/Time Parser
-
In the Name field, enter a name for the date/time parser.
-
In the Layout to be added field, enter a date/time layout with Go syntax.
For more information, see the documentation about the Go Programming Language Time Package’s Layout Constant.
-
Click Add.
-
(Optional) To add an additional layout, repeat the previous steps.
-
Click Save.
Next Steps
After you create a custom date/time parser, you can set it as the default date/time parser for your Search index.
To continue customizing your Search index, you can also:
To run a search and test the contents of your Search index, see Run A Simple Search with the Web Console or Run a Simple Search with the REST API and curl/HTTP.