public void UserDefinedPrimaryKeysOverridePresets()
        {
            var searchIndex = new FunctionIndexDefinition <DepositDto>(
                addPresetTransactionFields: true);

            var dto = new DepositDto();

            var uidField = searchIndex.Field(PresetSearchFieldName.tx_uid);

            Assert.False(uidField.IsKey);

            Assert.Equal(nameof(dto.Id), searchIndex.KeyField().Name);
        }
        public static GenericSearchDocument ToGenericElasticSearchDoc <TFunctionMessage>(
            this TransactionForFunctionVO <TFunctionMessage> functionCall,
            FunctionIndexDefinition <TFunctionMessage> indexDefinition) where TFunctionMessage : FunctionMessage, new()
        {
            var dictionary = new GenericSearchDocument();

            foreach (var field in indexDefinition.Fields)
            {
                var val = field.GetTransactionForFunctionValue(functionCall)?.ToElasticSearchFieldValue();
                if (val != null)
                {
                    dictionary.Add(field.Name.ToElasticName(), val);
                }
            }

            var id = indexDefinition.KeyField().GetTransactionForFunctionValue(functionCall);

            dictionary.SetId(id.ToString());

            return(dictionary);
        }