An REST API which can Filter Based on field

Hi,

I need a Search API that can filter based on a field value in the response body.
e.g:
I need to filter based on TYPE value

    {
      "took": 12,
      "responses": [
        {
          "took": 12,
          "timed_out": false,
          "_shards": {
            "total": 31,
            "successful": 31,
            "skipped": 0,
            "failed": 0
          },
          "hits": {
            "total": {
              "value": 49,
              "relation": "eq"
            },
            "max_score": 4.049412,
            "hits": [
              
              {
                "_index": "snow_sc_cat_item",
                "_type": "_doc",
                "_id": "d130ad75d7620200a9ad1e173e24d43c",
                "_score": 4.049412,
                "_source": {
                  "Availability": "Desktop and Classic Mobile",
                  "Category": "Hardware",
                  "Cart": "",
                  "Execution Plan": "",
                  "Display price property": "non_zero",
                  "Fulfillment group": "",
                  "Location": "null",
                  "Meta": "",
                  "Classic Mobile Picture Type": "Desktop",
                  "Model": "Apple iPhone 5",
                  "Name": "Microsoft Surface Pro 3",
                  "Ordered item link": "",
                  "Recurring price frequency": "null",
                  "Request method": "null",
                  "Created from item design": "",
                  "Short Description": "Microsoft Surface Pro 3",
                  "Template": "",
                  "Type": "Item",//Based on this
                  "Operating System Edition": "null",
                  "Operating System Version": "null",
                  "Compliance - Payment Card Industry Data Security Standard": "null",
                  "Presentation": "null",
                  "Pricing Quantity": "null",
                  "Pricing Unit": "null",
                  "Region": "null",
                  "Compliance - Sarbanes–Oxley Act": "null",
                  "Compliance - Security level": "null",
                  "Compliance - Segregation": "null",
                  "Service Catalogue Type": "null",
                  "Service Product": "null",
                  "Service Provider": "",
                  "Service Provider Reference": "",
                  "SLA Level": "null",
                  "Compliance - Solicitor Regulatory Compliance": "null",
                  "Storage Optimised": "null",
                  "Vendor": "Apple",
                  "Workflow": "Procurement Process Flow - Mobile",
                  "Created by": "admin",
                  "Display name": "Microsoft Surface Pro 3",
                  "Package": "Service Catalog core applications",
                  "Protection policy": "null",
                  "Application": "Global",
                  "Updated by": "system",
                  "Update name": "sc_cat_item_d130ad75d7620200a9ad1e173e24d43c"
                }
              }
            ]
          },
          "status": 200
        }
      ]
    }

Please help me on how to achieve this. Thanks in advance

Regards,
Nikhil Kumar. M

You need to run 2 queries. One to get the value for the Type field. The second which uses this value.

Yes One query which generates the response and another should be like Filter for field. To filter-out the values based on mentioned field's value.
Please help me with the API that could be really helpful for me

What do you mean? Which API? What di you try so far? What does not work?

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.