Help needed in making a query for elastic search

Hey,I am working on a index which has 300 fieds in it.Now there is a requirement where i have to make 2 field irrelevent for searching in that index.As of now i am using *.* to search .
i studied somewhere we can make enabled=false but that i cannot do becuase this index is used in some other scenerio as well.

current Query is

"bool":{"must":[{"query_string":{"query":"\"Java Developer\"","fields":["*.*"],"lenient":true}}]}}]

"fields":["star.star"],( as star symbol is getting deleted)

Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

This is the icon to use if you are not using markdown format:

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.
Please update your post. That way *.* won't get replaced.

One of the thing I'm thinking of is to use Field Level security with 2 different roles. One which has access and the other which has not.

Note that it probably requires a platinum license. You can start a trial anytime if you want to test it and switch back to basic if it does not fit your use case.

hey,Can't we make changes to the query only to fit the case?

You can specify the list of fields you want to search on using the query string query fields parameter (like you did with "fields":["*.*"] but by using actual list of field names) or with a multi match query.

1 Like

so specifying 298 fields would be a rigid solution,let's think of solution like this where in _source there is option to include and exclude.

 "_source": {
      "includes": [
        "*.count",
        "meta.*"
      ],
      "excludes": [
        "meta.description",
        "meta.other.*"
      ]
    }

do we have this kind of option in "fields"?or maybe in multi_match?
Like where i will specify the fields to search..

"fields":{
"includes": [
        "*.*"
      ],
      "excludes": [
        "meta.description",
        "meta.other"
      ]
    }

No I don't believe so.

May be a feature request to open?

Sure, maybe in future it could help me or the ones who's having a big index with 100's of fields