Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search Returns 404 with Multiple Indices using Date Math Resolution #1009

Open
zanes2016 opened this issue Jan 11, 2019 · 2 comments
Open

Search Returns 404 with Multiple Indices using Date Math Resolution #1009

zanes2016 opened this issue Jan 11, 2019 · 2 comments
Assignees
Labels

Comments

@zanes2016
Copy link

We should support multiple index searches with date math index name resolution. However, this does not work if one or more index uses date math resolution. Searches of multiple date math indices work fine using curl, but the golang elastic API returns a 404 error from ES.

Which version of Elastic are you using?

[latest commit] elastic.v6 (for Elasticsearch 6.x)

Expected behavior

Be able to specify and return search results for multiple indices using date math index name resolution. This works correctly with curl.

Example URL

https://host/<counters-{now/d}>,<counters-{now-1d/d}>/_search

This should return two indices for the current day and past day.

Expected Return (shortened)

{
    "counters-2019.01.10": {
        "aliases": {},
        "mappings": {
            "doc": {
                ...
            }
        },
        "settings": {
            "index": {
                "creation_date": "1547078418563",
                "number_of_replicas": "1",
                "number_of_shards": "5",
               ...
            }
        }
    },
    "counters-2019.01.11": {
        "aliases": {},
        "mappings": {
            "doc": {
                ...
            }
        },
        "settings": {
            "index": {
                "creation_date": "1547164803672",
                "number_of_replicas": "1",
                "number_of_shards": "5",
               ...
                }
            }
        }
    }
}

Again, this works fine when using curl.

Actual behavior

I would expect to be able to specify multiple indices with date math resolution in a single search query. However, ES returns a 404 error:
elastic: Error 400 (Bad Request)

Code

        searchResult, err := client.Search().
		Index("<counters-{now/d}>",  "<counters-{now-1d/d}>").
		Query(elastic.NewMatchAllQuery()).
		Size(0).
		Pretty(true).
		Do(context.Background())
	if err != nil {
		glog.Errorf("%s: %+v", err, searchResult)
		return err
	}
...
elastic: Error 400 (Bad Request)
...

Any steps to reproduce the behavior?

This happens consistently when using the client API. Works fine from curl.

@olivere
Copy link
Owner

olivere commented Jan 15, 2019

Hmm... on a gut level this looks like an encoding issue. Will look at it in the next release.

@olivere olivere self-assigned this Jan 15, 2019
@olivere olivere added the bug label Jan 15, 2019
@olivere olivere added this to the 6.2.16 milestone Jan 15, 2019
olivere added a commit that referenced this issue Jan 27, 2019
This should guard against #1009.
@olivere
Copy link
Owner

olivere commented Jan 27, 2019

@zanes2016 I've added a test for this and cannot reproduce. Can you have a look?

@olivere olivere removed this from the 6.2.16 milestone Jan 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants