def __get_painless_scripting_source(
        self, space_type: str, vector_field: str = "embedding"
    ) -> str:
        """
        For Painless Scripting, it returns the script source based on space type.
        This does not work with Opensearch Serverless currently.
        """
        source_value = (
            f"(1.0 + {space_type}(params.query_value, doc['{vector_field}']))"
        )
        if space_type == "cosineSimilarity":
            return source_value
        else:
            return f"1/{source_value}"

        For Painless Scripting, it returns the script source based on space type.
        This does not work with Opensearch Serverless currently.
        
llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py