App-search document API?

Is there a way to query the documents in an app search engine by more than just id?

I'm scanning document here:

and search here:

Looks like the only hooks we get is asking for all documents, or a specific document by id, or searching using a text string or number.

What I'm looking for is for a data set like users below, the ability to request a list of documents that match a particular value (e.g. status="Active", or organization contains "Navy")

Is that possible from either the Restful APIs or the Javascript client?

[
{
"id": 4,
"name": "Doe, Ann A. ",
"rank": "CTR",
"email": "Ann.a.doe@mail.mil",
"organization": "Navy • CNIC • CNDW",
"role": "Authorized User",
"status": "Active",
"edipi": "1456741258",
"date_created": "2019-03-09",
"last_login": "2019-12-20",
"groups": "CNDW",
"date_requested": null
},
{
"id": 5,
"name": "Doe, Jane T. ",
"rank": "CTR",
"email": "jane.t.doe@mail.mil",
"organization": "Navy • CNIC • EURAFCENT",
"role": "Authorized User",
"status": "Active",
"edipi": "1593574265",
"date_created": "2019-04-06",
"last_login": "2020-01-03",
"groups": "CNIC ",
"date_requested": null
},
...
]

Hey @fred_wang,

What I'm looking for is for a data set like users below, the ability to request a list of documents that match a particular value (e.g. status="Active", or organization contains "Navy")

The first part of that, status="Active can be achieved with a Filter.

The second part, is not possible. We can't currently do a "contains" in a string. I recommend changing your data to have an array of string values:

"organization": ["Navy", "CNIC", "EURAFCENT"]

If you can do that, then what you're describing can be achieved with the following:

{
  "query": "",
  "filters": {
    "any": [
      { "status": "Active" },
      { "organization": "Navy" }
    ]
  }
}

Does that make sense?

@JasonStoltz, this is exactly what I was looking for! Thank you!

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