0

similar to question I want to create a query on a sub field (which is not of type nested)

if data is in format

"fs": {
    "used": 1000,
    "mount_point": "/"
 }

as mentioned in answer by aaronfay I tried querying with

search.query('match', **{"fs.used": 0})

and it works as expected.

But for field named mount_point, the query returns empty response.

search.query('match', **{"fs.mount_point": "/"})

even if i have data which has mount_point = '/'. why?

1 Answer 1

1

What is your mappings for the mount_point field? You need that field to be of type keyword which means without any analyzer. By default it would be text which means it would be split into words and / is not a word so it would get dropped.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks for the response. Its the default mapping of topbeat index created by logstash. mount_point field's mapping is of type string ` "fs" : { ... "mount_point" : { "type" : "string" }, "used" : { "type" : "long" }, ... } }, ` so should i change the mapping of this field to keyword
solved temporarily by comparing with another field (which doesn't have only '/' in value. ` .query('match', **{"fs.device_name": "/dev/sda4"} `

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.