ElasticsearchClient v.8 QueryContainer alternative

Hi, I'm migrating .net 7 Nest client to the newer v8 .net client.

I have the following code and would like to question if there is an alternative to QueryContainer usage as you see next.

            QueryContainer filterPerfilUsuario;
            
            if (!isServidor)
            {
                filterPerfilUsuario = new QueryContainer(
                        new TermsQuery
                        {
                            Field = new Field("Nivel"),
                            Terms = (new[] { nivel0, nivel1 })
                        }
                    );
            }
            else
            {
                filterPerfilUsuario = new QueryContainer(
                    new MatchQuery
                    {
                        Field = new Field("Nivel"),
                        Query = nivel1
                    } && new TermsQuery
                    {
                        Field = new Field("IdUnidade"),
                        Terms = uas
                    }
                );
            }
3 Likes

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