Query Shard Exception: Failed to create query

Hello, i'm having trouble with a query for some of the input (with other texts works just fine). At first i thought it might be an encoding issue, but same input with different query also works.

Mapping:

{
  "mapping": {
    "_doc": {
      "properties": {
        "@timestamp": {
          "type": "date"
        },
        "@version": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "cod_calle": {
          "type": "long"
        },
        "code_first_street": {
          "type": "long"
        },
        "code_second_street": {
          "type": "long"
        },
        "geometry": {
          "type": "geo_shape"
        },
        "id": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "text": {
          "type": "text",
          "fields": {
            "raw": {
              "type": "text"
            },
            "variant_1": {
              "type": "text",
              "analyzer": "calle_analyzer"
            },
            "variant_2": {
              "type": "text",
              "analyzer": "search_calle_analyzer"
            }
          },
          "analyzer": "normal_analyzer"
        },
        "text_aliases": {
          "type": "text",
          "fields": {
            "raw": {
              "type": "text"
            },
            "variant_1": {
              "type": "text",
              "analyzer": "calle_analyzer"
            },
            "variant_2": {
              "type": "text",
              "analyzer": "search_calle_analyzer"
            }
          },
          "analyzer": "normal_analyzer"
        },
        "text_first_street": {
          "type": "text",
          "fields": {
            "raw": {
              "type": "text"
            },
            "variant_1": {
              "type": "text",
              "analyzer": "calle_analyzer"
            },
            "variant_2": {
              "type": "text",
              "analyzer": "search_calle_analyzer"
            }
          },
          "analyzer": "normal_analyzer"
        },
        "text_second_street": {
          "type": "text",
          "fields": {
            "raw": {
              "type": "text"
            },
            "variant_1": {
              "type": "text",
              "analyzer": "calle_analyzer"
            },
            "variant_2": {
              "type": "text",
              "analyzer": "search_calle_analyzer"
            }
          },
          "analyzer": "normal_analyzer"
        },
        "type": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        }
      }
    }
  }
}

Query:

GET _search
{
  "from": 0,
  "size": 50,
  "query": {
    "bool": {
      "must": {
        "multi_match": {
          "query": "cambiaste un mueble o electrodomestico de tu casa no lo dejes al lado del contenedor llamanos al 1950 3000 op 3 y lo pasamos a buscar gratis por tu casa https t co 7fl6ni8mqk",
          "fields": [
            "text",
            "text_aliases"
          ],
          "type": "best_fields",
          "cutoff_frequency": 1,
          "fuzziness": "1"
        }
      },
      "filter": {
        "term": {
          "type": "geonames"
        }
      },
      "should": {
        "multi_match": {
          "query": "cambiaste un mueble o electrodomestico de tu casa no lo dejes al lado del contenedor llamanos al 1950 3000 op 3 y lo pasamos a buscar gratis por tu casa https t co 7fl6ni8mqk",
          "fields": [
            "text.variant_1^2",
            "text.variant_2^3",
            "text_aliases.variant_1^2",
            "text_aliases.variant_2^3"
          ],
          "type": "best_fields",
          "cutoff_frequency": 1,
          "fuzziness": "1"
        }
      }
    }
  },
  "highlight": {
    "fields": {
      "*": {}
    },
    "number_of_fragments": 10
  }
}

Result:

#! Deprecation: Deprecated field [cutoff_frequency] used, replaced by [you can omit this option, the [multi_match] query can skip block of documents efficiently if the total number of hits is not tracked]
{
  "took" : 4,
  "timed_out" : false,
  "_shards" : {
    "total" : 4,
    "successful" : 3,
    "skipped" : 0,
    "failed" : 1,
    "failures" : [
      {
        "shard" : 0,
        "index" : "montevideo",
        "node" : "mk7Ltph-R7qsTEGGwhPULQ",
        "reason" : {
          "type" : "query_shard_exception",
          "reason" : """failed to create query: {
  "bool" : {
    "must" : [
      {
        "multi_match" : {
          "query" : "cambiaste un mueble o electrodomestico de tu casa no lo dejes al lado del contenedor llamanos al 1950 3000 op 3 y lo pasamos a buscar gratis por tu casa https t co 7fl6ni8mqk",
          "fields" : [
            "text^1.0",
            "text_aliases^1.0"
          ],
          "type" : "best_fields",
          "operator" : "OR",
          "slop" : 0,
          "fuzziness" : "1",
          "prefix_length" : 0,
          "max_expansions" : 50,
          "cutoff_frequency" : 1.0,
          "zero_terms_query" : "NONE",
          "auto_generate_synonyms_phrase_query" : true,
          "fuzzy_transpositions" : true,
          "boost" : 1.0
        }
      }
    ],
    "filter" : [
      {
        "term" : {
          "type" : {
            "value" : "geonames",
            "boost" : 1.0
          }
        }
      }
    ],
    "should" : [
      {
        "multi_match" : {
          "query" : "cambiaste un mueble o electrodomestico de tu casa no lo dejes al lado del contenedor llamanos al 1950 3000 op 3 y lo pasamos a buscar gratis por tu casa https t co 7fl6ni8mqk",
          "fields" : [
            "text.variant_1^2.0",
            "text.variant_2^3.0",
            "text_aliases.variant_1^2.0",
            "text_aliases.variant_2^3.0"
          ],
          "type" : "best_fields",
          "operator" : "OR",
          "slop" : 0,
          "fuzziness" : "1",
          "prefix_length" : 0,
          "max_expansions" : 50,
          "cutoff_frequency" : 1.0,
          "zero_terms_query" : "NONE",
          "auto_generate_synonyms_phrase_query" : true,
          "fuzzy_transpositions" : true,
          "boost" : 1.0
        }
      }
    ],
    "adjust_pure_negative" : true,
    "boost" : 1.0
  }
}""",
          "index_uuid" : "zGNcQL39S121EwbclWDDiQ",
          "index" : "montevideo",
          "caused_by" : {
            "type" : "array_index_out_of_bounds_exception",
            "reason" : "Index 0 out of bounds for length 0"
          }
        }
      }
    ]
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  }
}

If I remove "variant_1" fields from the Should clause It works, wich is more confusing.
Could someone help? Thank you

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