4

We have used minimal_english stemmer filter in our mapping. This is to ensure that only singular and plural are searchable and not similar words. eg. Test and Tests should be searchable on entering the term - Test - but Tester,Testers,Testing should not be. On trying to search using the below RESTful API, multi_field attribute types are searchable but nested attribute types are not:

curl -X GET "http://10.113.124.136:9400/libtester/_search?pretty=true" -d '{
  "query": {
    "query_string": {
      "query": " DescriptionDescription ",
      "fields": [
        "abc"
      ]
    }
  }
}'

Mappings are as shown below :

{
  "properties": {
    "abc": {
      "type": "multi_field",
      "fields": {
        "c_asset_id": {
          "type": "string",
          "index": "analyzed",
          "include_in_all": true,
          "analyzer": "basic_english"
        },
        "untouched": {
          "type": "string",
          "index": "analyzed",
          "include_in_all": false,
          "analyzer": "string_lowercase"
        }
      }
    },
    "xyz": {
      "type": "nested",
      "properties": {
        "c_viewpoint": {
          "type": "multi_field",
          "fields": {
            "c_viewpoint": {
              "type": "string",
              "index": "analyzed",
              "include_in_all": true,
              "analyzer": "basic_english"
            },
            "untouched": {
              "type": "string",
              "index": "analyzed",
              "include_in_all": false,
              "analyzer": "string_lowercase"
            }
          }
        }
      }
    },
    ...
  }
}

Is this to do with the mapping of nested types - xyz, that they are not searchable from the same API that multi_field types are?

Saeed Zhiany
  • 2,051
  • 9
  • 30
  • 41
Himadri Pant
  • 2,171
  • 21
  • 22

1 Answers1

1

You can search nested properties, it just requires slightly different syntax. You have to specify the path, and then explicitly use the path for each property you are searching.

This tutorial has a good overview of how nested documents work.

Zach
  • 9,591
  • 1
  • 38
  • 33
  • Thanks Zach, I have been able to able to correctly search singulars/ plurals terms alike. However, I noticed certain terms are failing such as 'shoe', 'mouse' and 'leaf'. Can you suggest something on this? – Himadri Pant Dec 31 '12 at 10:24
  • Likely a problem with how you are analyzing the terms, either for search or for index. Two of those terms have atypical plural forms (e.g. "mice", "leaves"). My first guess is that something is wrong with how you are stemming, but it's hard to know without seeing your full analyzers. – Zach Dec 31 '12 at 15:51