Hello,
For some reason I cannot get a search on anything but _all to work for my index. I currently have an index (mapping included) that is populated using the ingest attachment plugin. I am trying to search against a few specific fields using simple_query_string (specifically document.name, document.section.name, and document.section.content) but they just don't work.
First, my mapping:
{
  "fbs": {
    "mappings": {
      "institution": {
        "properties": {
          "document": {
            "type": "nested",
            "properties": {
              "expiration_date": {
                "type": "date"
              },
              "flags": {
                "type": "text",
                "norms": false
              },
              "id": {
                "type": "keyword"
              },
              "is_active": {
                "type": "boolean"
              },
              "is_current": {
                "type": "boolean"
              },
              "name": {
                "type": "text"
              },
              "section": {
                "type": "nested",
                "properties": {
                  "created_at": {
                    "type": "date"
                  },
                  "data": {
                    "type": "text",
                    "fields": {
                      "keyword": {
                        "type": "keyword",
                        "ignore_above": 256
                      }
                    }
                  },
                  "file": {
                    "type": "nested",
                    "properties": {
                      "author": {
                        "type": "text",
                        "fields": {
                          "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                          }
                        }
                      },
                      "content": {
                        "type": "text"
                      },
                      "content_length": {
                        "type": "long"
                      },
                      "content_type": {
                        "type": "text",
                        "fields": {
                          "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                          }
                        }
                      },
                      "date": {
                        "type": "date"
                      },
                      "language": {
                        "type": "text",
                        "fields": {
                          "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                          }
                        }
                      },
                      "title": {
                        "type": "text",
                        "fields": {
                          "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                          }
                        }
                      }
                    }
                  },
                  "filename": {
                    "type": "text",
                    "norms": false
                  },
                  "fingerprint": {
                    "type": "text",
                    "norms": false
                  },
                  "flags": {
                    "type": "text",
                    "norms": false
                  },
                  "id": {
                    "type": "keyword"
                  },
                  "is_active": {
                    "type": "boolean"
                  },
                  "name": {
                    "type": "text"
                  },
                  "updated_at": {
                    "type": "date"
                  }
                }
              },
              "start_date": {
                "type": "date"
              }
            }
          },
          "id": {
            "type": "keyword"
          },
          "name_en": {
            "type": "text",
            "norms": false
          },
          "name_fr": {
            "type": "text",
            "norms": false
          },
          "region_id": {
            "type": "keyword"
          }
        }
      }
    }
  }
}
Here's a document in my index:
{
  "_index": "fbs",
  "_type": "institution",
  "_id": "7691fcaa54659612b42b8a158d5d4b9e.pdf",
  "_version": 1,
  "found": true,
  "_source": {
    "name_fr": "Western University",
    "document": {
      "is_active": 1,
      "name": "Full-time Collective Agreement",
      "flags": "full-time",
      "section": {
        "filename": "7691fcaa54659612b42b8a158d5d4b9e.pdf",
        "is_active": 1,
        "file": {
          "date": "2005-03-17T18:16:19Z",
          "content_type": "application/pdf",
          "author": "TSm",
          "language": "en",
          "title": "Collective Agreement",
          "content": """<CONTENT OF PDF>
""",
          "content_length": 2791
        },
        "data": "<BASE 64 PDF>",
        "updated_at": "2017-02-23",
        "name": "Table of Contents",
        "flags": "full-time",
        "fingerprint": "a4ae893e292dd8a58e906eba7ddb8d70",
        "created_at": "2017-02-23",
        "id": 1
      },
      "id": 1,
      "is_current": 0,
      "expiration_date": "2006-06-30",
      "start_date": "2002-07-01"
    },
    "region_id": 2,
    "name_en": "Western University"
  }
}
If I perform this query, I get the result I want:
GET fbs/institution/_search
    "query": {
      "simple_query_string": {
        "query": "table",
        "fields": [
          "_all"  
        ]
      }
    }
}
If I perform this query, it fails -- when I try to explain why I get "no matching term"
GET fbs/institution/7691fcaa54659612b42b8a158d5d4b9e.pdf/_explain
{
    "query": {
      "simple_query_string": {
        "query": "table",
        "fields": [
          "document.section.name"  
        ]
      }
    }
}
{
  "_index": "fbs",
  "_type": "institution",
  "_id": "7691fcaa54659612b42b8a158d5d4b9e.pdf",
  "matched": false,
  "explanation": {
    "value": 0,
    "description": "Failure to meet condition(s) of required/prohibited clause(s)",
    "details": [
      {
        "value": 0,
        "description": "no match on required clause (document.section.name:table)",
        "details": [
          {
            "value": 0,
            "description": "no matching term",
            "details": []
          }
        ]
      },
...
So I'm positive I've done something very stupid here, but I can't for the life of me figure out what the hell I've done wrong. Anyone please point me in the right direction?!
John