这是一个宣布的重大变化。
一种替代方法是使用带有转换处理器的摄取节点来将该字段的布尔值存储到另一个布尔字段中:
PUT _ingest/pipeline/boolean-pipeline{ "description": "converts the content of the field to a boolean value", "processors" : [ { "convert" : { "field" : "user_data", "target_field" : "user_data_boolean", "type": "boolean", "on_failure" : [ { "set" : { "field" : "user_data_boolean", "value" : false } } ] } } ]}
然后,您可以使用该管道为数据建立索引
PUT test/doc/1?pipeline=boolean-pipeline{ "user_data": "true"}PUT test/doc/2?pipeline=boolean-pipeline{ "user_data": "auto_directorURL"}
结果,您将获得以下索引数据,这几乎是您期望的:
"hits" : [ { "_index" : "test", "_type" : "doc", "_id" : "2", "_score" : 1.0, "_source" : { "user_data" : "auto_directorURL", "user_data_boolean" : false } }, { "_index" : "test", "_type" : "doc", "_id" : "1", "_score" : 1.0, "_source" : { "user_data" : "true", "user_data_boolean" : true } }]
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)