func scalar(node expr.Node) (interface{}, bool) {
	switch n := node.(type) {

	case *expr.StringNode:
		return n.Text, true

	case *expr.NumberNode:
		if n.IsInt {
			// ES supports string encoded ints
			return n.Int64, true
		}
		return n.Float64, true

	case *expr.ValueNode:
		// Make sure this is a scalar value node
		switch n.Value.Type() {
		case value.BoolType, value.IntType, value.StringType, value.TimeType:
			return n.String(), true
		case value.NumberType:
			nn, ok := n.Value.(floatval)
			if !ok {
				return nil, false
			}
			return nn.Float(), true
		}
	case *expr.IdentityNode:
		if _, err := strconv.ParseBool(n.Text); err == nil {
			return n.Text, true
		}

	}
	return "", false
}
// scalar returns a JSONable representation of a scalar node type for use in ES
// filters.
//
// Does not support Null.
//
scalar returns a JSONable representation of a scalar node type for use in ES
filters.

Does not support Null.
// scalar returns a JSONable representation of a scalar node type for use in ES // filters . // // Does not support Null . //
func scalar(node expr.Node) (interface{}, bool) {
	switch n := node.(type) {
	case *expr.StringNode:
		return n.Text, true
	case *expr.NumberNode:
		if n.IsInt {
			return n.Int64, true
		}
		return n.Float64, true
	case *expr.ValueNode:
		switch n.Value.Type() {
		case value.BoolType, value.IntType, value.StringType, value.TimeType:
			return n.String(), true
		case value.NumberType:
			nn, ok := n.Value.(floatval)
			if !ok {
				return nil, false
			}
			return nn.Float(), true
		}
	case *expr.IdentityNode:
		if _, err := strconv.ParseBool(n.Text); err == nil {
			return n.Text, true
		}
	}
	return "", false
}
func scalar ( node expr . Node ) ( interface { } , bool ) { switch n := node . ( type ) { case * expr . StringNode : return n . Text , true case * expr . NumberNode : if n . IsInt { return n . Int64 , true } return n . Float64 , true case * expr . ValueNode : switch n . Value . Type ( ) { case value . BoolType , value . IntType , value . StringType , value . TimeType : return n . String ( ) , true case value . NumberType : nn , ok := n . Value . ( floatval ) if ! ok { return nil , false } return nn . Float ( ) , true } case * expr . IdentityNode : if _ , err := strconv . ParseBool ( n . Text ) ; err == nil { return n . Text , true } } return " " , false }
scalar returns a JSONable representation of a scalar node type for use in ES
filters.
scalar returns a JSONable representation of a scalar node type for use in ES filters .
// ES supports string encoded ints // Make sure this is a scalar value node