Skip to content

How do search on _all fields except X field? #11294

@abibell

Description

@abibell

Situation

Cluster contains several indices, types and documents with several fields. We want to search fulltext on-demand as opposed to normally since we have richer metadata. We don't want to list every field in fields in the query. I realise the fields property takes city.* format. Since listing every field that is not fulltext can be handled by Elastic as opposed to the application.

Request

Can we provide NOT field syntax in fields property something like !fulltext?

POST _search
{
   "query": {
    "query_string": {
       "query": "*",
       "fields": [
          "!fulltext"
       ]
    }
   }
}

My DIY experience

I tried to debug and find out if the syntax supported any other formats, as the help document didn't cover NOT fields. I had this error

Description Resource    Path    Location    Type
Project build error: Non-resolvable parent POM: Failure to transfer org.sonatype.oss:oss-parent:pom:7 from http://download.elastic.co/lucenesnapshots/${lucene.snapshot.revision} was cached in the local repository, resolution will not be reattempted until the update interval of lucene-snapshots has elapsed or updates are forced. Original error: Could not transfer artifact org.sonatype.oss:oss-parent:pom:7 from/to lucene-snapshots (http://download.elastic.co/lucenesnapshots/${lucene.snapshot.revision}): Illegal character in path at index 44: http://download.elastic.co/lucenesnapshots/${lucene.snapshot.revision}/org/sonatype/oss/oss-parent/7/oss-parent-7.pom and 'parent.relativePath' points at wrong local POM pom.xml /elasticsearch  line 27 Maven pom Loading Problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions