set properties for custom fields in search index

Posted by Community Admin on 03-Aug-2018 11:03

set properties for custom fields in search index

All Replies

Posted by Community Admin on 09-Oct-2016 00:00

Hi,

It seems that all fields that are pushed to be indexed in a back-end search engine are tokenised. I would like one of my custom fields to be non-tokenised by elasticsearch.

This is a standard feature of elasticsearch and is determined by setting a value of "not_analyzed" on the "index" property for the field. However the index propertyfor a field must be specified either when the index is created, or before any documents have been indexed. Sitefinity is responsible for the creation of the index, and I do not see any handle to customise properties of custom fields. They are all created with a type of "string" and default values for all other properties.

Is there a way to customise how Sitefinity creates a new index in Elasticsearch, or to change a property of a custom field?

At the moment, my solution is a manual process. When  using the "re-index" action on an existing index (under "Administration" -> "Search indexes"), which forces the deletion and re-creation of an index in elasticsearch, there is then a window of a few seconds before any documents are pushed in which I can run a command directly on the elasticsearch service to customise my fields -

curl -XPOST localhost:9200/myindex/_mapping -d'"properties":"myCustomField":"type":"string","index":"not_analyzed",'

It does work, but it would be much better to have this handled automatically by Sitefinity when it creates the index.

 

Thank

Vince

This thread is closed