ElasticSearch不适用于嵌套对象中的搜索

时间:2019-02-25 11:21:49

标签: java elasticsearch

我在用ElasticSearch 5.6(High Rest Client-Java API)中的嵌套映射搜索索引时遇到问题。当我查询嵌套对象时,它不会返回任何结果。当我查询标准字段(wikiField-文本和template.id-long)时,它将正确返回此过程。

下面,我附上我的映射,索引对象和用于搜索元数据的方法。我已经测试了参数:大小为1的地图 key TSL_ATS value Proc

映射:

asyncTask();

从索引返回的索引对象:

{
  "mappings": {
    "process": {
      "dynamic": "strict",
      "properties": {
        "meta": {
          "dynamic": "false",
          "type": "object",
          "properties": {
            "ID": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "mdWrap": {
              "type": "nested",
              "properties": {
                "test.metadata": {
                  "type": "nested",
                  "properties": {
                    "name": {
                      "type": "text",
                      "fields": {
                        "keyword": {
                          "type": "keyword",
                          "ignore_above": 256
                        }
                      }
                    },
                    "content": {
                      "type": "text",
                      "fields": {
                        "keyword": {
                          "type": "keyword",
                          "ignore_above": 256
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "template": {
          "properties": {
            "id": {
              "type": "long"
            }
          }
        },
        "wikiField": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        }
      }
    }
  }
}

用于查询具有特定元数据的过程的方法:

{
  "_index": "testindex",
  "_type": "process",
  "_id": "2",
  "_version": 7,
  "found": true,
  "_source": {
    "wikiField": "problem",
    "template.id": 1,
    "meta": [
      {
        "mdWrap": {
          "MDTYPE": "MODS",
          "xmlData": {
            "test": {
              "test": "http://meta.test.org/v1/",
              "metadata": [
                {
                  "name": "TitleDocMain",
                  "content": "Second process"
                },
                {
                  "name": "TitleDocMainShort",
                  "content": "Second"
                },
                {
                  "name": "TSL_ATS",
                  "content": "Proc"
                }
              ]
            }
          }
        },
        "ID": "DMDLOG_0000"
      },
      {
        "mdWrap": {
          "MDTYPE": "MODS",
          "xmlData": {
            "test": {
              "test": "http://meta.test.org/v1/",
              "metadata": {
                "name": "pathimagefiles",
                "content": "file:/2/images/Sec_Proc_tif"
              }
            }
          }
        },
        "ID": "DMDPHYS_0000"
      }
    ]
  }
}

0 个答案:

没有答案