Best way to search for multiple emails across multiple boards

Given 5 emails, I’m looking to see which ones exists in which boards(and which ones don’t). I have 5 different boards that I need to search in with those 5 emails.

Currenlty, I have some sort of linear search in place where I take one email, search across 5 boards. So for 5 emails its 5x5=25 api calls which results in a very slow response(yes I need the total response). I’m looking for suggestions to improve this so that I don’t get stuck in api calls for about a minute. Here’s what I’m exploring currently:

  1. Make 1 api call ber board, with all the email values passed at the same time
query {
  items_page_by_column_values (limit: 50, board_id: 123456789, columns: [{column_id: "email__1", column_values: ["test@emial.com", "tes2t@emial.com", "test3@emial.com"]}]) {
    cursor
    items {
      id
      name
      column_values {
      	id
        value
      }
    }
  }
}

This gives me fairly lower reponse time, but I’m curious to know if there is a way to only receive a certain number of columns. I know that there exists something like this for statuses, but not sure if anything can be done for email column.

  1. I haven’t found anything on this yet, but what would be even more nice is the above query, but for multiple boards.

Hey @Zepticona
I checked with the team and got a code that this should look like this:

query GetBoardItems {
  boards(ids: [7753601158, 7753604175, 37753606898]) {
    items_page(
      limit: 50
      query_params: {rules: [{column_id: "email__1", compare_value: ["a@a.com", "b@a.com", "c@a.com"], operator: any_of}]}
    ) {
      items {
        id
        name
        column_values {
          id
          value
        }
      }
    }
  }
}

Let me know if this helps

Hi @OmerK

I really apprecaite you getting back to me on this. It just shows how dedicated you are to helping the community.

Now, that’s amazing what you’ve given me. I kind of knew that it would be something like this but I couldn’t really figure it out.

By the way, on the process of lowering the query time, I discovered that the query takes significantly less time if I chain the queries per board. So if I have an email column titled email_1, email_2, and email_3 on 3 different boards, I could do somehting like

query {
  firstQuery: items_page_by_column_values(
    limit: 50
    board_id: 1613606727
    columns: [{column_id: "email_1", column_values: [${emails.map((str) => `"${str}"`).join(", ")}]}]
  ) {
    cursor
    items {
      id
      name
      board {
        name
      }
      column_values(ids: ["email_1"]) {
        id
        value
      }
    }
  }
  secondQuery: items_page_by_column_values(
    limit: 50
    board_id: 1613687876
    columns: [{column_id: "email_2", column_values: [${emails.map((str) => `"${str}"`).join(", ")}]}]
  ) {
    cursor
    items {
      id
      name
      board {
        name
      }
      column_values(ids: ["email_2"]) {
        id
        value
      }
    }
  }
  thirdQuery: items_page_by_column_values(
    limit: 50
    board_id: 1613695311
    columns: [{column_id: "email_3", column_values: [${emails.map((str) => `"${str}"`).join(", ")}]}]
  ) {
    cursor
    items {
      id
      name
      board {
        name
      }
      column_values(ids: ["email_3"]) {
        id
        value
      }
    }
  }
}

I have chained a total of 8 queries like this for 8 boards. I get a query time of about 7seconds on average for 3/4 emails which is pretty good for now.

My question to you is, will this new query lower the search time by a few seconds? Keep in mind that I’ll still have to chain a few queries like this. Because while 5 of my boards have the same column_id value for the email column, 2 of them use a different one, and 1 of them use another one. Obviously I’ll do my tests as well but wanted to know if you or the team have any data on the time complexity of this. Thanks!

Hello there @Zepticona,

Matias from the technical support team here!

We can not specify the response time for the queries since there are many fields and factors that can affect them.

We encourage the developers to test in their own specific scenarios, what works best for them in relation to response times when comparing different queries :smile:

Let us know if you have any other questions!

Cheers,
Matias