diff --git a/docs/_static/inventory/search_juniper_and_rats.png b/docs/_static/inventory/search_juniper_and_rats.png new file mode 100644 index 0000000000000000000000000000000000000000..1b7bce009fd639c3c8fb47aee7a81a0aac862a90 Binary files /dev/null and b/docs/_static/inventory/search_juniper_and_rats.png differ diff --git a/docs/_static/inventory/search_juniper_not_rats.png b/docs/_static/inventory/search_juniper_not_rats.png index ea1d5efab0ec9edf69d6bafb337de2e30d6b73c4..1915f8d42f7490354e134bbf5c4ebf1e7c3d4e40 100644 Binary files a/docs/_static/inventory/search_juniper_not_rats.png and b/docs/_static/inventory/search_juniper_not_rats.png differ diff --git a/docs/_static/inventory/search_wildcard.png b/docs/_static/inventory/search_wildcard.png new file mode 100644 index 0000000000000000000000000000000000000000..f8f59b8b47947268f76f6c2916f1a07cf648c198 Binary files /dev/null and b/docs/_static/inventory/search_wildcard.png differ diff --git a/docs/inventory.rst b/docs/inventory.rst index e6044ea0e55e47375b3b90e162b521d42c8f4e56..1c3403788d155e9c356e0f2fe3b2b0a0d99bb48f 100644 --- a/docs/inventory.rst +++ b/docs/inventory.rst @@ -19,13 +19,15 @@ The *items* page of the inventory lists all existing items. .. image:: _static/inventory.png +.. _inventory-search: + Search ------ You can find a specific item or group of items by using the search box. Elasticsearch is used as the full-text search engine and allows to use a query string “mini-languageâ€. -- To perform a free text search, simply enter a text string. For example, if you’re looking for Juniper devices, enter ``juniper``. Note that the search is case insensitive. +- To perform a free text search, simply enter a text string. For example, if you’re looking for Juniper devices, enter ``juniper``. Notice that the search is case insensitive. .. image:: _static/inventory/search_juniper.png @@ -39,15 +41,25 @@ Elasticsearch is used as the full-text search engine and allows to use a query s .. image:: _static/inventory/search_ics_id_field.png -- By default, all terms are optional, as long as one term matches. A search for ``foo bar baz`` will find any document that contains one or more of foo or bar or baz. Boolean operators can be used to provide more control. The preferred operators are + (this term must be present) and - (this term must not be present). For example to search all juniper devices not at RATS: ``juniper -RATS`` +- By default, all terms are optional, as long as one term matches. A search for ``foo bar baz`` will find any document that contains one or more of foo or bar or baz. Boolean operators can be used to provide more control. The preferred operators are ``+`` (this term must be present) and ``-`` (this term must not be present). For example to search all juniper devices not at RATS: ``juniper -location:rats`` .. image:: _static/inventory/search_juniper_not_rats.png +- You can also use the familiar boolean operators ``AND``, ``OR`` and ``NOT`` (also written ``&&``, ``||`` and ``!``). Here is how to search all juniper devices that are at RATS: ``juniper AND location:rats`` + +.. image:: _static/inventory/search_juniper_and_rats.png + +- Wildcard searches can be run using ``?`` to replace a single character and ``*`` to replace zero or more characters: ``AAA10?`` + + Be aware that wildcard queries can use an enormous amount of memory and perform very badly — just think how many terms need to be queried to match the query string ``"a* b* c*"``. + +.. image:: _static/inventory/search_wildcard.png + - You can search items where a field has any non-null value. To get items with a parent: ``_exists_:parent`` .. image:: _static/inventory/search_exists_parent.png -- To search a string that includes reserved characters (+ - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ /), you have to use double quotes. Here is how to search for an old JIRA TAG ``"TAG-250"`` or mac adress ``"7c:e2:ca:64:dd:61"``. +- To search a string that includes reserved characters ``+ - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ /``, you have to use double quotes. Here is how to search for an old JIRA TAG ``"TAG-250"`` or mac adress ``"7c:e2:ca:64:dd:61"``. .. image:: _static/inventory/search_quote_tag.png