Searching term in subdocuments with elasticsearch

こ雲淡風輕ζ 提交于 2019-12-08 17:29:40

I have managed to do that with following query;

{
  "query": {
    "query_string": {
      "query": "someterm",
      "fields": ["*.translation"]
    }
  }
}

or

{
  "query": {
    "multi_match": {
      "query": "someterm",
      "fields": ["*.translation"]
    }
  }
}

You can see elasticsearch google group conversation here

No, I do not believe this functionality is built into ElasticSearch at the moment. This answer suggests you could build the functionality with a script, but it would be super slow.

In general, ES doesn't play nicely with nested data. It supports nested fields, but many of the more advanced search functionality isn't capable of operating on complex nested data. My suggestion is to denormalize your data so that every translation is represented by a single item in the index, and link between them with ID numbers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!