Amazon OpenSearch Service

Power Query is an important feature in Microsoft Power BI that enables users to connect to various data sources and transform the data into the desired format for analysis. Amazon OpenSearch Service is a popular search and analytics service that can be used as a data source with Power BI. In this article, we will discuss the Power Query M Language Code for connecting to the Amazon OpenSearch Service data source from inside Power BI.

What is Amazon OpenSearch Service?

Amazon OpenSearch Service

Amazon OpenSearch Service is a search and analytics service that makes it easy to search, analyze, and visualize data. It provides an open-source search and analytics engine based on Elasticsearch. OpenSearch can be used to search data stored in various sources such as logs, documents, and metrics. It is a scalable and reliable service that can be used to analyze large datasets.

How to Connect to Amazon OpenSearch Service Data Source from Inside Power BI?

To connect to the Amazon OpenSearch Service data source from inside Power BI, you need to follow these steps:

1. Open Power BI Desktop and click on the “Get Data” option in the Home tab.

2. In the Get Data window, select “OpenSearch” in the “All” category. Alternatively, you can search for “OpenSearch” in the search bar.

3. In the OpenSearch window, enter the URL of the Amazon OpenSearch Service endpoint in the “Server” field. For example, https://my-opensearch-domain.us-east-1.es.amazonaws.com.

4. If your Amazon OpenSearch Service domain requires authentication, select the “Basic” option in the “Authentication Method” dropdown and enter the username and password in the respective fields.

5. Click on the “OK” button to connect to the Amazon OpenSearch Service data source.

Power Query M Language Code for Connecting to Amazon OpenSearch Service Data Source

The Power Query M Language is a powerful tool for transforming data in Power BI. It enables users to write custom code to connect to data sources, transform data, and create new columns. Here is an example of the Power Query M Language code for connecting to the Amazon OpenSearch Service data source:


let

Source = OpenSearch.Contents(“https://my-opensearch-domain.us-east-1.es.amazonaws.com”),

#”Filtered Rows” = Table.SelectRows(Source, each ([Name] = “my-index”)),

#”Expand Columns” = Table.ExpandRecordColumn(#”Filtered Rows”, “Value”, {“_source”}),

#”Expanded _source” = Table.ExpandRecordColumn(#”Expand Columns”, “_source”, {“field1”, “field2”}, {“field1”, “field2”})

in

#”Expanded _source”


In this code, the OpenSearch.Contents function is used to connect to the Amazon OpenSearch Service endpoint. The Filtered Rows step is used to filter the results to a specific index. The Expand Columns step is used to expand the “_source” column, which contains the fields of the index. Finally, the Expanded _source step is used to expand the individual fields of the “_source” column into separate columns.

Conclusion

Connecting to the Amazon OpenSearch Service data source from inside Power BI is a straightforward process. The Power Query M Language provides a flexible and powerful tool for transforming data from OpenSearch Service. With the right code, you can extract the desired data from OpenSearch Service and transform it into a format suitable for analysis in Power BI.

Power BI Training Courses by G Com Solutions (0800 998 9248)

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)

    Similar Posts