def to_es(self, schema):
     if not self.suffix:
         return MATCH_ALL
     elif is_op(self.expr, Variable_) and is_literal(self.suffix):
         var = first(schema.leaves(self.expr.var)).es_column
         return {"regexp": {var: ".*" + string2regexp(self.suffix.value)}}
     else:
         return PainlessSuffixOp.to_es_script(self, schema).to_es(schema)
示例#2
0
def to_esfilter(self, schema):
    if not self.field:
        return {"match_all": {}}
    elif isinstance(self.field, Variable) and isinstance(self.prefix, Literal):
        var = schema.leaves(self.field.var)[0].es_column
        return {"regexp": {var: ".*"+string2regexp(self.prefix.value)}}
    else:
        return ScriptOp("script",  self.to_painless(schema).script(schema)).to_esfilter(schema)
示例#3
0
def to_esfilter(self, schema):
    if not self.suffix:
        return {"match_all": {}}
    elif isinstance(self.expr, Variable) and isinstance(self.suffix, Literal):
        var = schema.leaves(self.expr.var)[0].es_column
        return {"regexp": {var: ".*"+string2regexp(self.suffix.value)}}
    else:
        return ScriptOp("script",  self.to_es_script(schema).script(schema)).to_esfilter(schema)
def to_es14_filter(self, schema):
    if not self.suffix:
        return {"match_all": {}}
    elif isinstance(self.expr, Variable) and isinstance(self.suffix, Literal):
        var = first(schema.leaves(self.expr.var)).es_column
        return {"regexp": {var: ".*"+string2regexp(self.suffix.value)}}
    else:
        return ScriptOp("script",  self.to_es14_script(schema).script(schema)).to_es14_filter(schema)
示例#5
0
 def to_esfilter(self, schema):
     if is_op(self.value, Variable_) and is_literal(self.find):
         return {
             "regexp": {
                 self.value.var:
                 ".*" + string2regexp(self.find.value) + ".*"
             }
         }
     else:
         return self.to_es_script(schema).script(schema).to_esfilter(schema)
示例#6
0
def to_esfilter(self, schema):
    if isinstance(self.value, Variable) and isinstance(self.find, Literal):
        return {
            "regexp": {
                self.value.var: ".*" + string2regexp(self.find.value) + ".*"
            }
        }
    else:
        return ScriptOp(
            "script",
            self.to_ruby(schema).script(schema)).to_esfilter(schema)
示例#7
0
 def to_esfilter(self):
     if isinstance(self.var, Variable) and isinstance(self.substring, Literal):
         return {"regexp": {self.var.var: ".*" + convert.string2regexp(convert.json2value(self.substring.json)) + ".*"}}
     else:
         return {"script": {"script": self.to_ruby()}}
示例#8
0
def to_esfilter(self, schema):
    if isinstance(self.value, Variable) and isinstance(self.find, Literal):
        return {"regexp": {self.value.var: ".*" + string2regexp(self.find.value) + ".*"}}
    else:
        return ScriptOp("script",  self.to_es_script(schema).script(schema)).to_esfilter(schema)