How to query object array?


(Red) #1

here is the document

{
   "2": {
        "20170804" :{
            "7": [{"loc":[1, 2], "ts":1}],
            "5": [{"loc":[1, 2], "ts":1}]
        }
    }
}

how to query ts field?


(David Pilato) #2

You can query:

  • "2.20170804.7.ts"
  • "2.20170804.5.ts"

(Red) #4

ive tried. but it does not work

ive test the mapping.

i’ve found that a field name could not be found when having these parameter settings.

– “enabled”:false,
– “dynamic”:false
i thought these settings only make the value not being indexed.
but now , the field name of these field could not be found.
and i've checked the mapping. these field did be added to the mapping.
but could not found when i use query like this:

curl -XGET 'http://172.16.4.240:9200/local3/places/_search' -d '
{
    "query": {
        "exists" : { "field" : "l" }
    }
}
'

i know it would not reduce the efficiency when i found a document.
but will it take a long time when i extract some fields when one document is very big?

  • i only need to extract the field which is set to "enabled":false, which means that the value not need to be indexed
  • i know the field which value is set to "dynamic":false will not be indexed or added the filed in value to mapping, but i need to find the field name fast when one document could be very large

"enabled":false
"dynamic":false

the mapping will be updated with new field name while the filed name could not be queried using exist query when the field has one these two settings.
does it mean the the field's name will not be indexed in a independent index?
and the field position inside one stored document would be found very efficiency when the field name has added to the mapping?


(David Pilato) #5

In your example, 1 is not a field name.

Again:

Could you provide a full recreation script as described in

It will help to better understand what you are doing.
Please, try to keep the example as simple as possible.


(Red) #6

im sorry.
the problem does exist.
my post has a mistake


(system) #7

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.