Legacy Knowledge Base
Published Sep. 10, 2025

How to set up Search Blueprints to be used with Search headless API

Written By

Daniel Carrillo Broeder

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • You do not find a suitable headless API or is not still developed by Liferay so you would like to create your own search blueprint and invoke it easily from Search API.
    • For example, retrieve draft or pending web content articles based on a structure field ( Feature Request ).

Environment

  • Quarterly Releases from 2024.Q3+

Resolution

  1. Starting from 2024.Q3, you can enable the release feature flag feature.flag.LPD-11232=true and feature.flag.LPS-179669=true in portal-ext.properties to be able to invoke your custom search blueprints from headless API.
  2. Create your custom search blueprint with any kind of search, and save the external reference code (ERC).
  3. Access the search API and execute GET /v1.0/search (getSearchPage) adding, at least, this parameters:
    • blueprintExternalReferenceCode : <ERC> - Custom Blueprint reference.
    • emptySearch: true - Enables empty search.
    • nestedFields: embedded - Get additional data of the result item.

 

Example - Obtain web contents of a given site in any status based on a custom text structure field 'fieldSample=sample'

  1. Verify feature flags are added to portal-ext.properties
  2. Create a custom structure and add some web contents having fieldSample with value 'sample'
  3. Create a new Blueprint:
    • Query Settings
      • Set "Web Content Article" as searchable type.
      • Disable all search query contributors.
    • Query Elements
      • Paste a 'MUST' elasticsearch query to filter web contents having fieldSample=sample. Could be similar to the following json (verify elasticsearch index to check the IDs and field name/value and adapt this code to your specific environment configuration):
      • {
        "nested":{
        "path":"ddmFieldArray",
        "query":{
        "bool":{
        "must":[{
        "term":{
        "ddmFieldArray.ddmFieldName":"ddm__keyword__12345__fieldSample_en_US"
        }
        },
        {
        "term":{
        "ddmFieldArray.ddmFieldValueKeyword_en_US":{
        "value": "sample"
        }
        }
        }]
        }
        }
        }
        }
      • Add a "Limit Search to These Sites" element and select a site.
    • (Optional) Modify the ERC to 'custom-erc' and save.
  4. Test it with search API

Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base