Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Elastic Search] página de pedidos Lista de queries com tempo de execução #59

Open
studiocuboweb opened this issue Oct 3, 2022 · 0 comments

Comments

@studiocuboweb
Copy link
Contributor

studiocuboweb commented Oct 3, 2022

Relatório das queries consumidas pelo elasticsearch na página de busca do achados e pedidos por tempo de execução.

Forma mapeadas 7 queries com o tempo de execução entre parênteses.

- Query 1: Lista os 10 últimos pedidos na base e mostra na página (média 22ms)

GET pedidos/_search
{
  "from" : 0,
  "size" : 10,
  "query" : {
    "bool" : {
      "should" : [
        {
          "match_all" : {
            "boost" : 1.0
          }
        },
        {
          "match_all" : {
            "boost" : 1.0
          }
        },
        {
          "match_all" : {
            "boost" : 1.0
          }
        }
      ],
      "disable_coord" : false,
      "adjust_pure_negative" : true,
      "boost" : 1.0
    }
  },
  "sort" : [
    {
      "pedidos_codigo_local" : {
        "order" : "desc"
      }
    }
  ],
  "highlight" : {
    "fields" : {
      "anexos_conteudo_arquivo" : {
        "fragment_size" : 300,
        "number_of_fragments" : 3
      },
      "interacoes_descricao_local" : {
        "fragment_size" : 300,
        "number_of_fragments" : 3
      },
      "pedidos_titulo_local" : {
        "fragment_size" : 300,
        "number_of_fragments" : 3
      },
      "pedidos_descricao_local" : {
        "fragment_size" : 300,
        "number_of_fragments" : 3
      }
    }
  },
  "ext" : { }
}

- Query 2: Autocomplete da caixa de busca - lista até 5 resultados (média 3ms)
obs: Utiliza a palavra CGU como filtro

GET pedidos/_search
{
    "from" : 0,
    "size" : 5,
    "query" : {
      "match_phrase_prefix" : {
        "pedidos_titulo_local" : {
          "query" : "CGU",
          "slop" : 0,
          "max_expansions" : 50,
          "boost" : 1.0
        }
      }
    },
    "_source" : {
      "includes" : [
        "pedidos_titulo_local"
      ],
      "excludes" : [ ]
    },
    "ext" : { }
  }

- Query 3: Autocomplete da caixa do filtro "Pedido enviado para" - lista até 1000 resultados (média 35ms)
obs: Utiliza a palavra CGU como filtro

GET pedidos/_search
{
  "from" : 0,
  "size" : 10000,
  "query" : {
    "match_phrase_prefix" : {
      "agentes_nome_local" : {
        "query" : "CGU",
        "slop" : 0,
        "max_expansions" : 50,
        "boost" : 1.0
      }
    }
  },
  "_source" : {
    "includes" : [
      "agentes_nome_local"
    ],
    "excludes" : [ ]
  },
  "ext" : { }
}

- Query 4: Autocomplete da caixa do filtro "Pedido disponibilizado por" - lista até 1000 resultados (média 333ms)
obs: Utiliza a frase "transparencia brasil" como filtro

GET pedidos/_search
{
    "from" : 0,
    "size" : 10000,
    "query" : {
      "match_phrase_prefix" : {
        "usuarios_nome_local" : {
          "query" : "transparencia brasil",
          "slop" : 0,
          "max_expansions" : 50,
          "boost" : 1.0
        }
      }
    },
    "_source" : {
      "includes" : [
        "usuarios_nome_local"
      ],
      "excludes" : [ ]
    },
    "ext" : { }
  }

- Query 5: Busca por uma frase em anexos - lista até 10 resultados (média 50ms)
obs: Utiliza a frase "CGU – Controladoria-Geral da União - Operações CGU..."

GET anexos/_search
{
  "from" : 0,
  "size" : 10,
  "query" : {
    "bool" : {
      "should" : [
        {
          "bool" : {
            "must" : [
              {
                "query_string" : {
                  "query" : "CGU – Controladoria-Geral da União - Operações CGU...",
                  "fields" : [
                    "pedidos_descricao_local^1.0",
                    "pedidos_titulo_local^1.0"
                  ],
                  "use_dis_max" : true,
                  "tie_breaker" : 0.0,
                  "default_operator" : "or",
                  "auto_generate_phrase_queries" : false,
                  "max_determined_states" : 10000,
                  "lowercase_expanded_terms" : true,
                  "enable_position_increment" : true,
                  "fuzziness" : "AUTO",
                  "fuzzy_prefix_length" : 0,
                  "fuzzy_max_expansions" : 50,
                  "phrase_slop" : 0,
                  "locale" : "und",
                  "escape" : false,
                  "boost" : 1.0
                }
              }
            ],
            "disable_coord" : false,
            "adjust_pure_negative" : true,
            "boost" : 1.0
          }
        },
        {
          "bool" : {
            "must" : [
              {
                "query_string" : {
                  "query" : "CGU – Controladoria-Geral da União - Operações CGU...",
                  "fields" : [
                    "interacoes_descricao_local^1.0"
                  ],
                  "use_dis_max" : true,
                  "tie_breaker" : 0.0,
                  "default_operator" : "or",
                  "auto_generate_phrase_queries" : false,
                  "max_determined_states" : 10000,
                  "lowercase_expanded_terms" : true,
                  "enable_position_increment" : true,
                  "fuzziness" : "AUTO",
                  "fuzzy_prefix_length" : 0,
                  "fuzzy_max_expansions" : 50,
                  "phrase_slop" : 0,
                  "locale" : "und",
                  "escape" : false,
                  "boost" : 1.0
                }
              }
            ],
            "disable_coord" : false,
            "adjust_pure_negative" : true,
            "boost" : 1.0
          }
        },
        {
          "bool" : {
            "must" : [
              {
                "query_string" : {
                  "query" : "CGU – Controladoria-Geral da União - Operações CGU...",
                  "fields" : [
                    "anexos_conteudo_arquivo^1.0"
                  ],
                  "use_dis_max" : true,
                  "tie_breaker" : 0.0,
                  "default_operator" : "or",
                  "auto_generate_phrase_queries" : false,
                  "max_determined_states" : 10000,
                  "lowercase_expanded_terms" : true,
                  "enable_position_increment" : true,
                  "fuzziness" : "AUTO",
                  "fuzzy_prefix_length" : 0,
                  "fuzzy_max_expansions" : 50,
                  "phrase_slop" : 0,
                  "locale" : "und",
                  "escape" : false,
                  "boost" : 1.0
                }
              }
            ],
            "disable_coord" : false,
            "adjust_pure_negative" : true,
            "boost" : 1.0
          }
        }
      ],
      "disable_coord" : false,
      "adjust_pure_negative" : true,
      "boost" : 1.0
    }
  },
  "sort" : [ ],
  "highlight" : {
    "fields" : {
      "anexos_conteudo_arquivo" : {
        "fragment_size" : 300,
        "number_of_fragments" : 3
      },
      "interacoes_descricao_local" : {
        "fragment_size" : 300,
        "number_of_fragments" : 3
      },
      "pedidos_titulo_local" : {
        "fragment_size" : 300,
        "number_of_fragments" : 3
      },
      "pedidos_descricao_local" : {
        "fragment_size" : 300,
        "number_of_fragments" : 3
      }
    }
  },
  "ext" : { }
}

- Query 6: Busca por uma frase em interacoes - lista até 10 resultados (média 30ms)
obs: Utiliza a frase "CGU – Controladoria-Geral da União - Operações CGU..."

GET interacoes/_search
{
  "from" : 0,
  "size" : 10,
  "query" : {
    "bool" : {
      "should" : [
        {
          "bool" : {
            "must" : [
              {
                "query_string" : {
                  "query" : "CGU – Controladoria-Geral da União - Operações CGU...",
                  "fields" : [
                    "pedidos_descricao_local^1.0",
                    "pedidos_titulo_local^1.0"
                  ],
                  "use_dis_max" : true,
                  "tie_breaker" : 0.0,
                  "default_operator" : "or",
                  "auto_generate_phrase_queries" : false,
                  "max_determined_states" : 10000,
                  "lowercase_expanded_terms" : true,
                  "enable_position_increment" : true,
                  "fuzziness" : "AUTO",
                  "fuzzy_prefix_length" : 0,
                  "fuzzy_max_expansions" : 50,
                  "phrase_slop" : 0,
                  "locale" : "und",
                  "escape" : false,
                  "boost" : 1.0
                }
              }
            ],
            "disable_coord" : false,
            "adjust_pure_negative" : true,
            "boost" : 1.0
          }
        },
        {
          "bool" : {
            "must" : [
              {
                "query_string" : {
                  "query" : "CGU – Controladoria-Geral da União - Operações CGU...",
                  "fields" : [
                    "interacoes_descricao_local^1.0"
                  ],
                  "use_dis_max" : true,
                  "tie_breaker" : 0.0,
                  "default_operator" : "or",
                  "auto_generate_phrase_queries" : false,
                  "max_determined_states" : 10000,
                  "lowercase_expanded_terms" : true,
                  "enable_position_increment" : true,
                  "fuzziness" : "AUTO",
                  "fuzzy_prefix_length" : 0,
                  "fuzzy_max_expansions" : 50,
                  "phrase_slop" : 0,
                  "locale" : "und",
                  "escape" : false,
                  "boost" : 1.0
                }
              }
            ],
            "disable_coord" : false,
            "adjust_pure_negative" : true,
            "boost" : 1.0
          }
        },
        {
          "bool" : {
            "must" : [
              {
                "query_string" : {
                  "query" : "CGU – Controladoria-Geral da União - Operações CGU...",
                  "fields" : [
                    "anexos_conteudo_arquivo^1.0"
                  ],
                  "use_dis_max" : true,
                  "tie_breaker" : 0.0,
                  "default_operator" : "or",
                  "auto_generate_phrase_queries" : false,
                  "max_determined_states" : 10000,
                  "lowercase_expanded_terms" : true,
                  "enable_position_increment" : true,
                  "fuzziness" : "AUTO",
                  "fuzzy_prefix_length" : 0,
                  "fuzzy_max_expansions" : 50,
                  "phrase_slop" : 0,
                  "locale" : "und",
                  "escape" : false,
                  "boost" : 1.0
                }
              }
            ],
            "disable_coord" : false,
            "adjust_pure_negative" : true,
            "boost" : 1.0
          }
        }
      ],
      "disable_coord" : false,
      "adjust_pure_negative" : true,
      "boost" : 1.0
    }
  },
  "sort" : [ ],
  "highlight" : {
    "fields" : {
      "anexos_conteudo_arquivo" : {
        "fragment_size" : 300,
        "number_of_fragments" : 3
      },
      "interacoes_descricao_local" : {
        "fragment_size" : 300,
        "number_of_fragments" : 3
      },
      "pedidos_titulo_local" : {
        "fragment_size" : 300,
        "number_of_fragments" : 3
      },
      "pedidos_descricao_local" : {
        "fragment_size" : 300,
        "number_of_fragments" : 3
      }
    }
  },
  "ext" : { }
}

- Query 7: Busca por uma frase em pedidos - lista até 10 resultados (média 27ms)
obs: Utiliza a frase "CGU – Controladoria-Geral da União - Operações CGU..."

GET pedidos/_search
{
  "from" : 0,
  "size" : 10,
  "query" : {
    "bool" : {
      "should" : [
        {
          "bool" : {
            "must" : [
              {
                "query_string" : {
                  "query" : "CGU – Controladoria-Geral da União - Operações CGU...",
                  "fields" : [
                    "pedidos_descricao_local^1.0",
                    "pedidos_titulo_local^1.0"
                  ],
                  "use_dis_max" : true,
                  "tie_breaker" : 0.0,
                  "default_operator" : "or",
                  "auto_generate_phrase_queries" : false,
                  "max_determined_states" : 10000,
                  "lowercase_expanded_terms" : true,
                  "enable_position_increment" : true,
                  "fuzziness" : "AUTO",
                  "fuzzy_prefix_length" : 0,
                  "fuzzy_max_expansions" : 50,
                  "phrase_slop" : 0,
                  "locale" : "und",
                  "escape" : false,
                  "boost" : 1.0
                }
              }
            ],
            "disable_coord" : false,
            "adjust_pure_negative" : true,
            "boost" : 1.0
          }
        },
        {
          "bool" : {
            "must" : [
              {
                "query_string" : {
                  "query" : "CGU – Controladoria-Geral da União - Operações CGU...",
                  "fields" : [
                    "interacoes_descricao_local^1.0"
                  ],
                  "use_dis_max" : true,
                  "tie_breaker" : 0.0,
                  "default_operator" : "or",
                  "auto_generate_phrase_queries" : false,
                  "max_determined_states" : 10000,
                  "lowercase_expanded_terms" : true,
                  "enable_position_increment" : true,
                  "fuzziness" : "AUTO",
                  "fuzzy_prefix_length" : 0,
                  "fuzzy_max_expansions" : 50,
                  "phrase_slop" : 0,
                  "locale" : "und",
                  "escape" : false,
                  "boost" : 1.0
                }
              }
            ],
            "disable_coord" : false,
            "adjust_pure_negative" : true,
            "boost" : 1.0
          }
        },
        {
          "bool" : {
            "must" : [
              {
                "query_string" : {
                  "query" : "CGU – Controladoria-Geral da União - Operações CGU...",
                  "fields" : [
                    "anexos_conteudo_arquivo^1.0"
                  ],
                  "use_dis_max" : true,
                  "tie_breaker" : 0.0,
                  "default_operator" : "or",
                  "auto_generate_phrase_queries" : false,
                  "max_determined_states" : 10000,
                  "lowercase_expanded_terms" : true,
                  "enable_position_increment" : true,
                  "fuzziness" : "AUTO",
                  "fuzzy_prefix_length" : 0,
                  "fuzzy_max_expansions" : 50,
                  "phrase_slop" : 0,
                  "locale" : "und",
                  "escape" : false,
                  "boost" : 1.0
                }
              }
            ],
            "disable_coord" : false,
            "adjust_pure_negative" : true,
            "boost" : 1.0
          }
        }
      ],
      "disable_coord" : false,
      "adjust_pure_negative" : true,
      "boost" : 1.0
    }
  },
  "sort" : [ ],
  "highlight" : {
    "fields" : {
      "anexos_conteudo_arquivo" : {
        "fragment_size" : 300,
        "number_of_fragments" : 3
      },
      "interacoes_descricao_local" : {
        "fragment_size" : 300,
        "number_of_fragments" : 3
      },
      "pedidos_titulo_local" : {
        "fragment_size" : 300,
        "number_of_fragments" : 3
      },
      "pedidos_descricao_local" : {
        "fragment_size" : 300,
        "number_of_fragments" : 3
      }
    }
  },
  "ext" : { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant