0
votes

I am doing a very basic search-by-field with elastic search:

My index mapping is something like:

{
  "channels": {
    "mappings": {
      "channel": {
        "properties": {
          "channel": {
            "properties": {
              "description": {
                "type": "string"
              },
              "id": {
                "type": "long"
              },
              "name": {
                "type": "string"
              },
.................
....................

and my query is like:

{
"query": 
 { 
 "match":
  { 

   "description": "hubble"

   } 

  } 

}

Now, this search results 0 hits, even if 'hubble' is present in the description field of a document.

However, when I run this query on _all field, it returns the document as expected.

As seen in the mapping, the description field is being analyzed as full-text (which is the default option). So, when only this field is specified, the search should return a hit.

What am I missing?

1
Try channel.description instead, since according to your mapping it seems that description is an inner field of the channel object ;-)Val

1 Answers

0
votes

Using 'channel.description' helped. Should have thought of this!

Thanks Val.