ElasticSearch布尔查询到Solrj查询

时间:2018-10-01 10:41:26

标签: elasticsearch solr solrj booleanquery

是否有任何工具或简单的技术可以将复杂的ES布尔查询迁移到Solr / Solrj查询。
我知道must => AND should => OR需要更改。 在此处查询示例-

{
  "bool": {
    "must": [
      {
        "term": {
          "locale": {
            "value": "XXX",
            "boost": 1
          }
        }
      },
      {
        "terms": {
          "contentType": [
            "YYY",
            "ZZZ"
          ],
          "boost": 1
        }
      },
      {
        "terms": {
          "docId": [
            "ABC",
            "JKL"
          ],
          "boost": 1
        }
      },
      {
        "term": {
          "unPublished": {
            "value": false,
            "boost": 1
          }
        }
      }
    ],
    "disable_coord": false,
    "adjust_pure_negative": true,
    "boost": 1
  }
}

1 个答案:

答案 0 :(得分:1)

您可以使用JSON Query DSL and compound queries

{
    "query": {
        "bool": {
            "must": [
                "title:solr",
                "content:(lucene solr)"
            ],
            "must_not": "{!frange u:3.0}ranking"
        }
    }
}