How to make use of _meta when using search API

hello,

is there a way to include the _meta data of an index when doing a search on multiple indices?
In my case I have lots of indices which makes it kind of hard to provide them for a search on "Multiple Indices" and also using wildcard to narrow down the indices is not option.
However I could provide meta data for each index, such as {"visible" : true}.
With that said, back to my question.. is there a way to make use of _meta data when searching indices?

Thanks a lot in advance.
Best regards,
Peter

Anyone could help me?

Please, anyone?

What type of metadata are you referring to? Where is this stored?

I was talking about the _meta data for an index ( https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-meta-field.html )

@Christian_Dahlqvist
and my question is, when I'm adding data there in the meta data, can I make use of it when doing a search for documents on all indices?

Not as far as I know, but am not entirely certain. Might need to wait some someone else to chime in.

Anyone else who might have an idea?

can I make use of it when doing a search for documents on all indices?

No. It's only part of the mapping. It's not part of documents.

that's to bad :frowning: is there any other way to archive a single search on a great number of indices, without having to name them? (wildcards won't do I'm affraid :confused: )

I don't understand the relationship between the original question and this question:

is there any other way to archive a single search on a great number of indices

wildcards won't do I'm affraid

Searching for

GET foo*/_search

is fine.

It's unclear to me what you are trying to achieve here.

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

You might be able to use aliases to group indices.

@dadoonet sorry, english is not my mother tongue.. I mean that I can't use wildcards in my case, because there is not a pattern that I can apply.. for instance I have a list of indices, such as

  • contracts
  • plans
  • notes
  • ..and way more..

lots of these indices are "public" (this information is stored in _meta data at the moment)
but a few indices are private (in relation "a few".. they're still quite a lot of them)
.. and what I want to do/archive is to do a search on all "public" indices.

@Christian_Dahlqvist thank you for mentioning aliases. It looks like that I can do exactly what I want.
If I understood it correctly, then I could create an alias called "public" and just add all my "public" indices to it.. and when I want to search on all "public" indices, then I'll just have to call

GET public/_search

is that somewhat correct?

Yes, sounds correct.

With aliases it works like a charm :slight_smile: thank you both for your help.

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