Elasticsearch. Nested field type and raw string subfield -


i has mapping:

      {        "properties":{           /*some fields ommited*/,           "properties":{              "type":"nested",              "properties":{                 "fielda":{                    "type":"string",                    "fields":{                       "raw":{                          "index":"not_analyzed",                          "type":"string"                       }                    }                 }              }           }        }     }  

and documents:

      {       /*some fields ommited*/,        "properties":{           "fielda":"one"        }     }      {       /*some fields ommited*/,        "properties":{           "fielda":"two"        }     }  

and on.

i try make query:

      {       "query": {         "nested": {           "query": {             "term": {               "fielda.raw": "one"             }           },           "path": "properties"         }       }     }  

there no results found. if try use same query field other type (not string, , without raw subfield) works. how should write query case? thanks!

p.s. field "fielda" has subfield raw because need field analyzed , not analyzed @ same time

you need specify full path nested field:

{    "query": {       "nested": {          "path": "properties",          "query": {             "term": {                "properties.fielda.raw": "one"             }          }       }    } } 

here code used test it:

http://sense.qbox.io/gist/f2d9e5eae7496ca0fce8d2d23e17bf4d72d9300a


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -