Legendary investor Peter Lynch once said: "Far more money has been lost by investors trying to anticipate corrections, than lost in the corrections themselves." In other words, even if a market crash seems imminent, no one actually knows the future, and trying to time the market often results in missed opportunities.

From that perspective, it makes more sense to invest on a regular basis, even if it's a small sum of money. In doing so, you build positions through dollar-costing averaging, which helps protect your portfolio from short-term market volatility. With that in mind, Elastic (ESTC 1.14%) and Palantir Technologies (PLTR -0.23%) look like smart stocks to buy right now.

Here's why.

Investor looking at her phone, a pensive expression on her face.

Image source: Getty Images.

1. Elastic

Elastic is a search company. At the core of its platform is the Elastic Stack, a set of software tools designed to ingest and log data from any source (e.g. software, infrastructure), then help clients search and analyze that information. Broadly speaking, these tools have three use cases: enterprise search, observability, and security.

Elastic enterprise search is a workplace search engine. This application allows users to sift through corporate resources to find a particular item; it also allows developers to embed search bars in websites and mobile apps. Similarly, Elastic observability unifies logs, metrics, and application traces, allowing IT teams to analyze performance data, troubleshoot problems, and keep business-critical systems online. And Elastic security brings the same features to threat detection.

Digital transformation has been a powerful growth driver for Elastic. As enterprises have adopted new technologies and digitized various processes, workplace search, observability, and security have become more critical. At the same time, Elastic's developer-friendly tools and freemium pricing model have helped the company win new customers at a rapid clip. In fact, Elastic is the most popular workplace search engine by a wide margin, according to DB-Engines.

That advantage has helped the company grow its top line quickly. And while Elastic isn't profitable on a GAAP basis, it did generate $9.1 million in free cash flow over the last year.

Metric

Q1 2021 (TTM)

Q1 2022 (TTM)

CAGR

Revenue

$466.8 million

$672.7 million

44%

Source: YCharts. Note: Q1 2022 ended July 31, 2021. TTM = trailing-12-months. CAGR = compound annual growth rate.

Turning to the future, digital transformation should remain a tailwind for Elastic, and management is executing on a strong growth strategy.

The company recently enhanced its security offering with the launch of an extended detection and response platform, a product that unifies security information and event management, endpoint protection, and cloud security. Elastic also rolled out new features for its enterprise search and observability applications, simplifying data ingestion and analytics to optimize search and automate root cause analysis.

Management currently values the company's market opportunity at $78 billion, meaning Elastic has plenty of room to grow. And given its strong competitive position, I think shareholders will be well rewarded in the years ahead. That's why you should consider adding this growth stock to your portfolio.

2. Palantir Technologies

Palantir helps clients manage and make sense of big data. The company's software platforms -- Gotham (government sector) and Foundry (commercial sector) -- simplify data integration and analytics, allowing companies to unify siloed data sets, make informed decisions, and build AI models and data-driven applications.

For example, Palantir's software helps manufacturers optimize supply chains, pharmaceutical companies accelerate drug discovery, and financial service providers detect and prevent fraud. Of course, data analytics is a trendy industry and Palantir faces plenty of competition, but its past gives it an edge over its rivals.

Specifically, U.S. intelligence agencies (like the CIA and NSA) have used Palantir's software to handle classified information, demonstrating the company's expertise in data governance. Not surprisingly, Palantir's brand name has become synonymous with government-grade security, and that has translated into impressive financial results.

The company's top line is growing at a steady clip, and Palantir generated $61.7 million in free cash flow over the past year.

Metric

Q2 2020 (TTM)

Q2 2021 (TTM)

CAGR

Revenue

$901.1 million

$1.3 billion

47%

Source: YCharts. TTM = trailing-12-months. CAGR = compound annual growth rate.

During the most recent quarter, Palantir closed 62 new deals worth at least $1 million, and 21 of those contracts are worth $10 million or more. The company also grew its commercial customers by 32% on a sequential basis. This should help supercharge revenue from the commercial sector, which has been growing more slowly than sales in the government sector.

Going forward, digital transformation will continue to accelerate data production, and organizations that have the tools to harness that data stand to gain a competitive advantage. This tailwind should be a powerful growth driver for Palantir. That's why this growth stock looks like a good addition to a diversified portfolio.