1

So I have a search created with elasticsearch request within Vuejs that runs great and all works but as soon as I add any size/from parameters into the query I get the error "Options contains invalid key: size" but I'm unsure of where it's going wrong. I have tried changing it to a get and I have tried rebuilding the query in several different ways but keep getting the same result.

 let buildURL = 'https://blahblahblah.com/search';

        const article = { query: query.query,
                          size: 50
        };

        const headers = {
            'Authorization':'$token',
            'Content-Type':'application/json',
        };


        let querydata = await $axios.$post(buildURL, article, { headers });

 
Val
  • 207,596
  • 13
  • 358
  • 360
  • Are you sending your search query directly to the `_search` endpoint of Elasticsearch (because I see `search` in your `buildURL` ?) or do you have a proxy layer that builds the query? – Val Jun 16 '21 at 09:41
  • @Val The url I send to is hosted on elasticsearch –  Jun 16 '21 at 09:46
  • So it should be `_search` not `search`, typo right? – Val Jun 16 '21 at 09:49
  • Also can you share the full error you're getting? I think that error is not coming from Elasticsearch but something else in the middle because `Options contains invalid key` is not an error message known to be coming from Elasticsearch... unless maybe if you're using App Search, is it the case? – Val Jun 16 '21 at 09:49
  • @Val No, 'search' works, using _search gives me an error and yeah, I'm using App Search –  Jun 16 '21 at 09:54

2 Answers2

1

Options contains invalid key is not an error coming out of Elasticsearch directly. The component you're interacting with is called App Search and is a search engine layer on top of Elasticsearch.

So, all you need to change is the following:

    const article = { query: query.query,
                      page: { size: 50 }           <---- change this line
    };

That should do the trick

Val
  • 207,596
  • 13
  • 358
  • 360
0
  1. passing of param size index option not define
  2. Or there might be another option to get size , might be limit 0,50

Share interface file