在 Mapping 里面,将 dynamic 参数设置成 strict 可以拒绝索引包含未知字段的文档。 此条 Tips 由 medcl 贡献。

关于elasticsearch查询

Elasticsearch | 作者 arvin | 发布于2017年05月22日 | 阅读数:3730

拿MySQL来说
SELECT * FROM tb_data WHERE firstName = secondName.
 
如何在ES中实现上述的功能呢?
已邀请:

redhat

赞同来自: arvin

{
    "query": {
        "bool": {
            "filter": {
                "bool": {
                    "must": {
                        "script": {
                            "script": {
                                "inline": "doc['firstname'].value == doc['lastname'].value"
                            }
                        }
                    }
                }
            }
        }
    }
}

wyntergreg

赞同来自:

有两种方式,一种拼url,一种发json
https://www.elastic.co/guide/e ... .html

arvin

赞同来自:

不好意思,可能我意思没表达清楚。
 
如何实现从ES是查询出文档中firstname和secondName数据相等的数据。

要回复问题请先登录注册