Elasticsearch setting a start node


(william crawley) #1

HI All,

I have a directory structure:
w:\docs
w:\docs\set1
w:\docs\set2 etc.

In my config W:\docs is set as my root directory for elasticsearch. For most searches starting here is fine, but On some searches I know that the documents I'm looking for will be in set1 for instance. What do I need to set to tell Elasticsearch to limit the search to set1? I'm using Elasticsearch 5.5.1

I thought it might be something like:

GET myindex/_search?q=content:Dave AND (hits.hits._source.path.real=:w//Docs//set1//*)&sort=hits.hits._source.file.last_modified:desc:size=10

but it still returns all docs with content 'Dave' regardless of location

but if I have files with 'dave' in the root or set2 they still get returned

OR using the style :
GET myindex/_search { "query": { "wildcard" : { "path.real" : "W:\\\\Docs\\\\set1\\\\*" } }

will return only the documents in this directory, but I cant seem to combine it with content.


(william crawley) #2

The solution is:

GET myindex/_search?q=content:Dav AND (path.real=:"""w:\\Docs\\set1\\*""")


(system) #3

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